diff --git a/src/test/java/org/json/junit/XMLTest.java b/src/test/java/org/json/junit/XMLTest.java index 7d22610d7..aefaa49da 100644 --- a/src/test/java/org/json/junit/XMLTest.java +++ b/src/test/java/org/json/junit/XMLTest.java @@ -1111,6 +1111,7 @@ public void testIndentComplicatedJsonObject(){ "}" ; JSONObject jsonObject = new JSONObject(str); String actualIndentedXmlString = XML.toString(jsonObject, 1); + JSONObject actualJsonObject = XML.toJSONObject(actualIndentedXmlString); String expected = "true\n" + "\n" + " 2022-10-05T00:00:00+03:00\n" + @@ -1170,7 +1171,8 @@ public void testIndentComplicatedJsonObject(){ " 1664917200\n" + "\n" + "null\n"; - assertEquals(actualIndentedXmlString, expected); + JSONObject expectedJsonObject = XML.toJSONObject(expected); + assertTrue(expectedJsonObject.similar(actualJsonObject)); } @@ -1183,6 +1185,7 @@ public void testIndentSimpleJsonObject(){ " }}"; JSONObject jsonObject = new JSONObject(str); String actual = XML.toString(jsonObject, "Test", 2); + JSONObject actualJsonObject = XML.toJSONObject(actual); String expected = "\n" + " \n" + " sonoo\n" + @@ -1190,7 +1193,8 @@ public void testIndentSimpleJsonObject(){ " true\n" + " \n" + "\n"; - assertEquals(actual, expected); + JSONObject expectedJsonObject = XML.toJSONObject(expected); + assertTrue(expectedJsonObject.similar(actualJsonObject)); } @Test @@ -1201,6 +1205,7 @@ public void testIndentSimpleJsonArray(){ "] "; JSONArray jsonObject = new JSONArray(str); String actual = XML.toString(jsonObject, 2); + JSONObject actualJsonObject = XML.toJSONObject(actual); String expected = "\n" + " Ram\n" + " Ram@gmail.com\n" + @@ -1209,7 +1214,8 @@ public void testIndentSimpleJsonArray(){ " Bob\n" + " bob32@gmail.com\n" + "\n"; - assertEquals(actual, expected); + JSONObject expectedJsonObject = XML.toJSONObject(expected); + assertTrue(expectedJsonObject.similar(actualJsonObject)); }