diff --git a/build.gradle b/build.gradle index 5a5be37..8a3708a 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,6 @@ dependencies { testImplementation 'junit:junit:4.13.1' testImplementation 'com.jayway.jsonpath:json-path:2.1.0' testImplementation 'org.mockito:mockito-core:4.2.0' - testImplementation 'org.skyscreamer:jsonassert:1.5.1' } subprojects { diff --git a/pom.xml b/pom.xml index 8bbcc3c..720529c 100644 --- a/pom.xml +++ b/pom.xml @@ -72,13 +72,6 @@ 4.2.0 test - - - org.skyscreamer - jsonassert - 1.5.1 - test - diff --git a/src/test/java/org/json/junit/JSONMLTest.java b/src/test/java/org/json/junit/JSONMLTest.java index 4d36498..154af64 100644 --- a/src/test/java/org/json/junit/JSONMLTest.java +++ b/src/test/java/org/json/junit/JSONMLTest.java @@ -762,7 +762,8 @@ public class JSONMLTest { final String xml = JSONML.toString(originalObject); final JSONObject revertedObject = JSONML.toJSONObject(xml, false); final String newJson = revertedObject.toString(); - assertTrue("original JSON does not equal the new JSON", originalObject.similar(revertedObject)); + assertTrue("JSON Objects are not similar", originalObject.similar(revertedObject)); + assertTrue("JSON Strings are not similar", new JSONObject(originalJson).similar(new JSONObject(newJson))); } // these tests do not pass for the following reasons: diff --git a/src/test/java/org/json/junit/JSONObjectTest.java b/src/test/java/org/json/junit/JSONObjectTest.java index 4eefea8..ac9a287 100644 --- a/src/test/java/org/json/junit/JSONObjectTest.java +++ b/src/test/java/org/json/junit/JSONObjectTest.java @@ -57,7 +57,6 @@ import org.junit.Test; import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.JsonPath; -import org.skyscreamer.jsonassert.JSONAssert; /** * JSONObject, along with JSONArray, are the central classes of the reference app. @@ -2026,8 +2025,10 @@ public class JSONObjectTest { "\"key3\":\"val3\""+ "}"; JSONObject jsonObject = new JSONObject(jsonObjectStr); - JSONAssert.assertEquals("jsonObject valueToString() incorrect", - JSONObject.valueToString(jsonObject), jsonObject.toString(), false); + assertTrue("jsonObject valueToString() incorrect", + new JSONObject(JSONObject.valueToString(jsonObject)) + .similar(new JSONObject(jsonObject.toString())) + ); String jsonArrayStr = "[1,2,3]"; JSONArray jsonArray = new JSONArray(jsonArrayStr); @@ -2037,8 +2038,9 @@ public class JSONObjectTest { map.put("key1", "val1"); map.put("key2", "val2"); map.put("key3", "val3"); - JSONAssert.assertEquals("map valueToString() incorrect", - jsonObject.toString(), JSONObject.valueToString(map), false); + assertTrue("map valueToString() incorrect", + new JSONObject(jsonObject.toString()) + .similar(new JSONObject(JSONObject.valueToString(map)))); Collection collection = new ArrayList(); collection.add(Integer.valueOf(1)); collection.add(Integer.valueOf(2));