Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes robot-core Junit test failures due to line ending differences #1147

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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#");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down