From e5bb50890b7220485cc1b90511d10f4ccaa25fbb Mon Sep 17 00:00:00 2001 From: David Mason Date: Tue, 29 Jan 2013 16:29:08 +1000 Subject: [PATCH] update PropReaderTest to expect os-specific line endings in written files --- .../java/org/zanata/adapter/properties/PropReaderTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zanata-adapter-properties/src/test/java/org/zanata/adapter/properties/PropReaderTest.java b/zanata-adapter-properties/src/test/java/org/zanata/adapter/properties/PropReaderTest.java index d2851d9..fdfd485 100644 --- a/zanata-adapter-properties/src/test/java/org/zanata/adapter/properties/PropReaderTest.java +++ b/zanata-adapter-properties/src/test/java/org/zanata/adapter/properties/PropReaderTest.java @@ -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"; @@ -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