From df4c951142fbec091879f854a41f36d32256322d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 8 Feb 2017 19:40:53 +0000 Subject: [PATCH 1/2] builder:CheckstyleWriter: use system's line separator --- .../kemitix/checkstyle/ruleset/builder/CheckstyleWriter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriter.java b/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriter.java index c82f1f7..5ce2daa 100644 --- a/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriter.java +++ b/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriter.java @@ -50,7 +50,7 @@ import java.util.stream.Stream; @RequiredArgsConstructor class CheckstyleWriter implements CommandLineRunner { - private static final String NEWLINE = "\n"; + private static final String NEWLINE = System.getProperty("line.separator"); private final OutputProperties outputProperties; From 4de68a84ce1e3ba3415633ea114c419d16adafa1 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 8 Feb 2017 19:50:54 +0000 Subject: [PATCH 2/2] builder:CheckstyleWriterTest: use system's file separator --- .../checkstyle/ruleset/builder/CheckstyleWriterTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java index 2412652..da7d873 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java @@ -30,6 +30,8 @@ public class CheckstyleWriterTest { private static final String TEMPLATE = "C:%s\nTW:%s"; + private static final String FILE_SEPARATOR = System.getProperty("file.separator"); + private CheckstyleWriter checkstyleWriter; private OutputProperties outputProperties; @@ -181,9 +183,11 @@ public class CheckstyleWriterTest { @Test public void throwRteIfErrorWritingFile() throws Exception { //given - outputProperties.setDirectory(Paths.get("/../imaginary")); + final String imaginary = String.join(FILE_SEPARATOR, "", "..", "imaginary"); + outputProperties.setDirectory(Paths.get(imaginary)); exception.expect(RuntimeException.class); - exception.expectMessage("java.nio.file.NoSuchFileException: /../imaginary/checkstyle-LAYOUT.xml"); + exception.expectMessage( + "java.nio.file.NoSuchFileException: " + imaginary + FILE_SEPARATOR + "checkstyle-LAYOUT.xml"); //when checkstyleWriter.run(); }