Skip to content

Commit 1a61af8

Browse files
committed
Fixed flaky tests in XMLTest.java
1 parent 11c29c3 commit 1a61af8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/test/java/org/json/junit/XMLTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,9 @@ public void shouldCreateExplicitEndTagWithEmptyValueWhenConfigured(){
11841184
JSONObject jsonObject = new JSONObject(jsonString);
11851185
String expectedXmlString = "<encloser><outer><innerOne></innerOne><innerTwo>two</innerTwo></outer></encloser>";
11861186
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(true));
1187-
assertEquals(expectedXmlString, xmlForm);
1187+
JSONObject actualJsonObject = XML.toJSONObject(xmlForm);
1188+
JSONObject expectedJsonObject = XML.toJSONObject(expectedXmlString);
1189+
assertTrue(expectedJsonObject.similar(actualJsonObject));
11881190
}
11891191

11901192
@Test
@@ -1193,7 +1195,9 @@ public void shouldNotCreateExplicitEndTagWithEmptyValueWhenNotConfigured(){
11931195
JSONObject jsonObject = new JSONObject(jsonString);
11941196
String expectedXmlString = "<encloser><outer><innerOne/><innerTwo>two</innerTwo></outer></encloser>";
11951197
String xmlForm = XML.toString(jsonObject,"encloser", new XMLParserConfiguration().withCloseEmptyTag(false));
1196-
assertEquals(expectedXmlString, xmlForm);
1198+
JSONObject actualJsonObject = XML.toJSONObject(xmlForm);
1199+
JSONObject expectedJsonObject = XML.toJSONObject(expectedXmlString);
1200+
assertTrue(expectedJsonObject.similar(actualJsonObject));
11971201
}
11981202

11991203

0 commit comments

Comments
 (0)