diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java index f3a16ba1f9003..dab683beb9624 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java @@ -25,6 +25,9 @@ import org.apache.pulsar.common.schema.KeyValueEncodingType; import org.apache.pulsar.common.schema.SchemaInfo; import org.apache.pulsar.common.schema.SchemaType; +import org.json.JSONException; +import org.skyscreamer.jsonassert.JSONAssert; +import org.skyscreamer.jsonassert.JSONCompareMode; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -289,8 +292,8 @@ public static Object[][] schemas() { } @Test(dataProvider = "schemas") - public void testSchemaInfoToString(SchemaInfo si, String jsonifiedStr) { - assertEquals(si.toString(), jsonifiedStr); + public void testSchemaInfoToString(SchemaInfo si, String jsonifiedStr) throws JSONException { + JSONAssert.assertEquals(si.toString(), jsonifiedStr, JSONCompareMode.NON_EXTENSIBLE); } public static class SchemaInfoBuilderTest { @@ -327,7 +330,7 @@ public void testSetProperties() { } @Test - public void testNullPropertyValue() { + public void testNullPropertyValue() throws JSONException { final Map map = new HashMap<>(); map.put("key", null); @@ -339,7 +342,7 @@ public void testNullPropertyValue() { .build(); // null key will be skipped by Gson when serializing JSON to String - assertEquals(si.toString(), INT32_SCHEMA_INFO); + JSONAssert.assertEquals(si.toString(), INT32_SCHEMA_INFO, JSONCompareMode.NON_EXTENSIBLE); } } }