From 9b2cebf11c644123276df0db624445c06275e341 Mon Sep 17 00:00:00 2001 From: zhihao11ui Date: Wed, 4 Sep 2024 02:43:51 -0500 Subject: [PATCH] Use JSONAssert to check equal JSONs --- core/pom.xml | 6 ++++++ .../test/java/org/everit/json/schema/ObjectSchemaTest.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index c0670e30..0b551441 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -278,5 +278,11 @@ 2.2 test + + org.skyscreamer + jsonassert + 1.5.1 + test + diff --git a/core/src/test/java/org/everit/json/schema/ObjectSchemaTest.java b/core/src/test/java/org/everit/json/schema/ObjectSchemaTest.java index 56549624..10e8fd89 100644 --- a/core/src/test/java/org/everit/json/schema/ObjectSchemaTest.java +++ b/core/src/test/java/org/everit/json/schema/ObjectSchemaTest.java @@ -33,6 +33,7 @@ import org.json.JSONObject; import org.json.JSONPointer; import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; import com.google.re2j.Pattern; @@ -412,7 +413,7 @@ public void toStringWithUnprocessedProps() { JSONObject rawSchemaJson = loader.readObj("tostring/objectschema-unprocessed.json"); Schema schema = SchemaLoader.load(rawSchemaJson); String actual = schema.toString(); - assertThat(new JSONObject(actual), sameJsonAs(rawSchemaJson)); + JSONAssert.assertEquals(rawSchemaJson.toString(), actual, false); } @Test