try {
// given
File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
FileWriter writer = FileWriterFactory.create(testFile);
String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTestBefore.txt"),
"UTF-8");
writer.writeText(preparedSource);
// when
String[] args = new String[] { "src/main/java/org/junithelper/core/config/LineBreakPolicy.java" };
System.setProperty("junithelper.skipConfirming", "true");
System.setProperty("junithelper.configProperties",
"src/test/resources/junithelper-config_forceLF.properties");
MakeTestCommand.main(args);
// then
Thread.sleep(100L);
InputStream is = new FileInputStream(testFile);
String source = IOUtil.readAsString(is, "UTF-8");
assertThat(source.contains("\r"), is(false)); // TEST
} finally {
File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
FileWriter writer = FileWriterFactory.create(testFile);
String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTest.txt"), "UTF-8");
writer.writeText(preparedSource);
}
}