diff --git a/robot-core/src/test/java/org/obolibrary/robot/DiffOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/DiffOperationTest.java index 0e3b8bf73..bba25629b 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/DiffOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/DiffOperationTest.java @@ -55,7 +55,8 @@ public void testCompareModified() throws IOException, OWLOntologyCreationExcepti assertFalse(actual); String expected = IOUtils.toString( - this.getClass().getResourceAsStream("/simple1.diff"), Charset.defaultCharset()); + this.getClass().getResourceAsStream("/simple1.diff"), Charset.defaultCharset()) + .replaceAll("\r\n", "\n"); assertEquals(expected, writer.toString()); } @@ -77,7 +78,8 @@ public void testCompareModifiedWithLabels() throws IOException { assertFalse(actual); String expected = IOUtils.toString( - this.getClass().getResourceAsStream("/simple.diff"), Charset.defaultCharset()); + this.getClass().getResourceAsStream("/simple.diff"), Charset.defaultCharset()) + .replaceAll("\r\n", "\n"); assertEquals(expected, writer.toString()); } diff --git a/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java b/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java index a70110995..8ecf95131 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java @@ -53,7 +53,7 @@ public void testAddPrefixes() throws IOException { ioh.addPrefixes(context); // Get the context back from IOHelper - String outputContext = ioh.getContextString(); + String outputContext = ioh.getContextString().replaceAll("\r\n", "\n"); assertEquals(inputContext, outputContext); } @@ -166,7 +166,7 @@ public void testPrefixHandling() throws IOException { String json = "{\n" + " \"@context\" : {\n" + " \"foo\" : \"http://example.com#\"\n" + " }\n" + "}"; - assertEquals("Check JSON-LD", json, ioh.getContextString()); + assertEquals("Check JSON-LD", json, ioh.getContextString().replaceAll("\r\n", "\n")); ioh.addPrefix("bar: http://example.com#"); expected.put("bar", "http://example.com#"); diff --git a/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java index 0f6d9a760..50803c7b0 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java @@ -48,12 +48,14 @@ private void testReportProducesCorrectOutput(String extension) throws Exception File.createTempFile("1016-report-json-failure-output", "." + extension); ReportOperation.report(ontology, iohelper, outputFile.toString(), Collections.emptyMap()); final String output = - IOUtils.toString(new FileInputStream(outputFile), Charset.defaultCharset()).trim(); + IOUtils.toString(new FileInputStream(outputFile), Charset.defaultCharset()) + .trim() + .replaceAll("\r\n", "\n"); final InputStream expected = getClass().getResourceAsStream("/1016-report-json-failure/output." + extension); assert expected != null; final String expectedOutput = - IOUtils.toString(expected, StandardCharsets.UTF_8.name()).trim(); + IOUtils.toString(expected, StandardCharsets.UTF_8.name()).trim().replaceAll("\r\n", "\n"); Assert.assertEquals(expectedOutput, output); } catch (YAMLException e) { e.printStackTrace();