Fix OperationBlockMacroTests on Windows

This commit is contained in:
Andy Wilkinson
2017-03-07 18:30:00 +00:00
parent 347f14f617
commit d3fdd0bef7

View File

@@ -78,7 +78,8 @@ public class OperationBlockMacroTests {
@Test
public void includeSnippetInSection() throws Exception {
String result = this.asciidoctor.convert(
"== Section\n" + "operation::some-operation[snippets='curl-request']",
"[[bruce]]\n== Section\n"
+ "operation::some-operation[snippets='curl-request']",
this.options);
assertThat(result, equalTo(getExpectedContentFromFile("snippet-in-section")));
}
@@ -131,6 +132,15 @@ public class OperationBlockMacroTests {
throws URISyntaxException, IOException {
Path filePath = Paths.get(
this.getClass().getResource("/operations/" + fileName + ".html").toURI());
return new String(Files.readAllBytes(filePath));
String content = new String(Files.readAllBytes(filePath));
if (isWindows()) {
return content.replace("\n", "\r\n");
}
return content;
}
private boolean isWindows() {
return File.separatorChar == '\\';
}
}