diff --git a/build.gradle b/build.gradle
index 8a3708a..5a5be37 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,7 @@ 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 720529c..8bbcc3c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,6 +72,13 @@
4.2.0
test
+
+
+ org.skyscreamer
+ jsonassert
+ 1.5.1
+ test
+
diff --git a/src/test/java/org/json/junit/JSONObjectTest.java b/src/test/java/org/json/junit/JSONObjectTest.java
index 2de8f81..4eefea8 100644
--- a/src/test/java/org/json/junit/JSONObjectTest.java
+++ b/src/test/java/org/json/junit/JSONObjectTest.java
@@ -57,6 +57,7 @@ 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.
@@ -2025,8 +2026,8 @@ public class JSONObjectTest {
"\"key3\":\"val3\""+
"}";
JSONObject jsonObject = new JSONObject(jsonObjectStr);
- assertTrue("jsonObject valueToString() incorrect",
- JSONObject.valueToString(jsonObject).equals(jsonObject.toString()));
+ JSONAssert.assertEquals("jsonObject valueToString() incorrect",
+ JSONObject.valueToString(jsonObject), jsonObject.toString(), false);
String jsonArrayStr =
"[1,2,3]";
JSONArray jsonArray = new JSONArray(jsonArrayStr);
@@ -2036,8 +2037,8 @@ public class JSONObjectTest {
map.put("key1", "val1");
map.put("key2", "val2");
map.put("key3", "val3");
- assertTrue("map valueToString() incorrect",
- jsonObject.toString().equals(JSONObject.valueToString(map)));
+ JSONAssert.assertEquals("map valueToString() incorrect",
+ jsonObject.toString(), JSONObject.valueToString(map), false);
Collection collection = new ArrayList();
collection.add(Integer.valueOf(1));
collection.add(Integer.valueOf(2));