mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 18:55:30 +08:00
Fixed flaky tests in XMLTest.java
This commit is contained in:
@@ -1184,7 +1184,9 @@ public class XMLTest {
|
|||||||
JSONObject jsonObject = new JSONObject(jsonString);
|
JSONObject jsonObject = new JSONObject(jsonString);
|
||||||
String expectedXmlString = "<encloser><outer><innerOne></innerOne><innerTwo>two</innerTwo></outer></encloser>";
|
String expectedXmlString = "<encloser><outer><innerOne></innerOne><innerTwo>two</innerTwo></outer></encloser>";
|
||||||
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(true));
|
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(true));
|
||||||
assertEquals(expectedXmlString, xmlForm);
|
JSONObject actualJsonObject = XML.toJSONObject(xmlForm);
|
||||||
|
JSONObject expectedJsonObject = XML.toJSONObject(expectedXmlString);
|
||||||
|
assertTrue(expectedJsonObject.similar(actualJsonObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1193,7 +1195,9 @@ public class XMLTest {
|
|||||||
JSONObject jsonObject = new JSONObject(jsonString);
|
JSONObject jsonObject = new JSONObject(jsonString);
|
||||||
String expectedXmlString = "<encloser><outer><innerOne/><innerTwo>two</innerTwo></outer></encloser>";
|
String expectedXmlString = "<encloser><outer><innerOne/><innerTwo>two</innerTwo></outer></encloser>";
|
||||||
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(false));
|
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(false));
|
||||||
assertEquals(expectedXmlString, xmlForm);
|
JSONObject actualJsonObject = XML.toJSONObject(xmlForm);
|
||||||
|
JSONObject expectedJsonObject = XML.toJSONObject(expectedXmlString);
|
||||||
|
assertTrue(expectedJsonObject.similar(actualJsonObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user