Skip to content

Commit

Permalink
Pay attention to system.lineseparator in XML formatter tests
Browse files Browse the repository at this point in the history
Use the helper method to unify on the system line separator.
  • Loading branch information
akurtakov committed Jan 23, 2025
1 parent 052dabe commit bf02009
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ private void simpleTest(String sourceFileName, String targetFileName, Formatting

XmlDocumentFormatter xmlFormatter = new XmlDocumentFormatter();
xmlFormatter.setDefaultLineDelimiter(System.lineSeparator());
String result = xmlFormatter.format(Files.readString(getBuildFile(sourceFileName).toPath()), prefs);
String expectedResult = Files.readString(getBuildFile(targetFileName).toPath());
// file content read via the helper method as it unifies the line separator to
// the system one
String result = xmlFormatter.format(
getReaderContentAsString(Files.newBufferedReader(getBuildFile(sourceFileName).toPath())), prefs);
String expectedResult = getReaderContentAsString(
Files.newBufferedReader((getBuildFile(targetFileName).toPath())));

assertEquals(expectedResult, result);
}
Expand Down

0 comments on commit bf02009

Please sign in to comment.