mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 11:25:30 -04:00
Fix XMLTest on Windows
XMLTest.testIndentComplicatedJsonObjectWithArrayAndWithConfig fails when run on Windows due to mismatching linebreaks (that aren't important for the test's functionality) between the actual and expected strings. For the actual strings, linebreaks are canonized to the platform's native linebreak using `replaceAll("\\n|\\r\\n", System.getProperty("line.separator")`. However, the expected result is read from a file, and is left with the linebreaks that were originally used to create it. The solution is to perform the same canonization on both strings. Closes #781
This commit is contained in:
parent
79af389f7a
commit
fe45fa9cfb
@ -1239,7 +1239,8 @@ public class XMLTest {
|
|||||||
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) {
|
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) {
|
||||||
expected.append(buffer, 0, numRead);
|
expected.append(buffer, 0, numRead);
|
||||||
}
|
}
|
||||||
assertEquals(expected.toString(), actualString.replaceAll("\\n|\\r\\n", System.getProperty("line.separator")));
|
assertEquals(expected.toString().replaceAll("\\n|\\r\\n", System.getProperty("line.separator")),
|
||||||
|
actualString.replaceAll("\\n|\\r\\n", System.getProperty("line.separator")));
|
||||||
} finally {
|
} finally {
|
||||||
if (xmlStream != null) {
|
if (xmlStream != null) {
|
||||||
xmlStream.close();
|
xmlStream.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user