From b440b00d395f218d3b2ce89854e2b3b3cc7989ac Mon Sep 17 00:00:00 2001 From: sheheryar aamir Date: Sun, 23 Jun 2024 20:45:52 +0200 Subject: [PATCH] use org.json library and fix test --- README.md | 10 ---------- pom.xml | 6 +++--- .../skyscreamer/jsonassert/JSONArrayWithNullTest.java | 4 ++-- .../org/skyscreamer/jsonassert/JSONAssertTest.java | 8 ++++---- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 2a0c4d0f..078c6052 100644 --- a/README.md +++ b/README.md @@ -98,16 +98,6 @@ Who uses JSONassert? + [Shazam](http://www.shazam.com/) + [Thucydides](http://thucydides.net/) -* * * - -org.json --------- - -This implementation uses a clean-room implementation of the org.json -library implemented for the Android system, released under the Apache 2.0 license. See -[com.vaadin.external.google:android-json](http://search.maven.org/#artifactdetails%7Ccom.vaadin.external.google%7Candroid-json%7C0.0.20131108.vaadin1%7Cjar) -That jar does **not** include the org.json.JSONString interface, so a new implementation of that interface is added to this source. - Resources --------- diff --git a/pom.xml b/pom.xml index 68d0cdac..41064dea 100644 --- a/pom.xml +++ b/pom.xml @@ -48,9 +48,9 @@ - com.vaadin.external.google - android-json - 0.0.20131108.vaadin1 + org.json + json + 20240303 junit diff --git a/src/test/java/org/skyscreamer/jsonassert/JSONArrayWithNullTest.java b/src/test/java/org/skyscreamer/jsonassert/JSONArrayWithNullTest.java index c5a5da5f..cc52aaa5 100644 --- a/src/test/java/org/skyscreamer/jsonassert/JSONArrayWithNullTest.java +++ b/src/test/java/org/skyscreamer/jsonassert/JSONArrayWithNullTest.java @@ -32,7 +32,7 @@ public void testJSONArrayWithNullValueAndJsonObject() throws JSONException { private JSONArray getJSONArray1() { JSONArray jsonArray1 = new JSONArray(); jsonArray1.put(1); - jsonArray1.put(null); + jsonArray1.put(JSONObject.NULL); jsonArray1.put(3); jsonArray1.put(2); return jsonArray1; @@ -41,7 +41,7 @@ private JSONArray getJSONArray1() { private JSONArray getJSONArray2() { JSONArray jsonArray1 = new JSONArray(); jsonArray1.put(1); - jsonArray1.put(null); + jsonArray1.put(JSONObject.NULL); jsonArray1.put(3); jsonArray1.put(2); return jsonArray1; diff --git a/src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java b/src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java index e39c80ba..f444dd69 100644 --- a/src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java +++ b/src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java @@ -498,14 +498,14 @@ public void testAssertEqualsJSONObject2Boolean() throws JSONException { @Test public void testAssertEqualsString2JsonComparator() throws IllegalArgumentException, JSONException { - JSONAssert.assertEquals("Message", "{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":1, \"id\":2}}", + JSONAssert.assertEquals("Message", "{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":2}}", new CustomComparator( JSONCompareMode.STRICT, new Customization("entry.id", new RegularExpressionValueMatcher("\\d")) )); - performAssertEqualsTestForMessageVerification("{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":1, \"id\":as}}", + performAssertEqualsTestForMessageVerification("{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":as}}", new CustomComparator( JSONCompareMode.STRICT, new Customization("entry.id", @@ -626,14 +626,14 @@ public void testAssertNotEqualsJSONObject2Boolean() throws JSONException { @Test public void testAssertNotEqualsString2JsonComparator() throws IllegalArgumentException, JSONException { - JSONAssert.assertNotEquals("Message", "{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":1, \"id\":hh}}", + JSONAssert.assertNotEquals("Message", "{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":hh}}", new CustomComparator( JSONCompareMode.STRICT, new Customization("entry.id", new RegularExpressionValueMatcher("\\d")) )); - performAssertNotEqualsTestForMessageVerification("{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":1, \"id\":2}}", + performAssertNotEqualsTestForMessageVerification("{\"entry\":{\"id\":x}}", "{\"entry\":{\"id\":2}}", new CustomComparator( JSONCompareMode.STRICT, new Customization("entry.id",