Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.skyscreamer/jsonassert -->
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/org/json/junit/JSONObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

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.
Expand Down Expand Up @@ -2025,8 +2026,8 @@ public void valueToString() {
"\"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);
Expand All @@ -2036,8 +2037,8 @@ public void valueToString() {
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<Integer> collection = new ArrayList<Integer>();
collection.add(Integer.valueOf(1));
collection.add(Integer.valueOf(2));
Expand Down