Merge pull request #9 from kemitix/cross-platform-build

Cross platform build
This commit is contained in:
Paul Campbell 2017-02-08 19:56:19 +00:00 committed by GitHub
commit aa443a26a6
2 changed files with 7 additions and 3 deletions

View file

@ -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;

View file

@ -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();
}