Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
update PropReaderTest to expect os-specific line endings in written f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
davidmason committed Jan 29, 2013
1 parent 3e8623d commit e5bb508
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -32,6 +32,7 @@ public class PropReaderTest
private static final Logger log = LoggerFactory.getLogger(PropReaderTest.class);
private static final String TEST_OUTPUT_DIR_STRING = "target/test-output";
private static final File TEST_OUTPUT_DIR = new File(TEST_OUTPUT_DIR_STRING);
private static final String SYSTEM_LINE_ENDING = System.getProperty("line.separator");
PropReader propReader;
static final String ISO_8859_1 = "ISO-8859-1";
String locale = "fr";
Expand Down Expand Up @@ -105,11 +106,12 @@ private void assertInputAndOutputDocContentSame(String docName) throws FileNotFo
InputStream origStream = getResourceAsStream(docName);

String origContent = IOUtils.toString(origStream);
String newlineAdjustedOrigContent = origContent.replaceAll("\n", SYSTEM_LINE_ENDING);
String newContent = IOUtils.toString(newStream);

// note: this does not allow for differences in whitespace, so if tests
// start failing this should be updated to use a less strict comparison
assertThat(newContent, Matchers.equalTo(origContent));
assertThat(newContent, Matchers.equalTo(newlineAdjustedOrigContent));
}

private InputStream getResourceAsStream(String relativeResourceName) throws FileNotFoundException
Expand Down

0 comments on commit e5bb508

Please sign in to comment.