diff --git a/pom.xml b/pom.xml index 0bba7f617876c..442b45fafa92b 100644 --- a/pom.xml +++ b/pom.xml @@ -215,6 +215,7 @@ flexible messaging model and an intuitive client API. 2.0.2 3.25.0-GA 2.3.1 + 1.5.0 0.6.1 diff --git a/pulsar-client/pom.xml b/pulsar-client/pom.xml index e3eab8b3cb649..dca5f4f81987d 100644 --- a/pulsar-client/pom.xml +++ b/pulsar-client/pom.xml @@ -151,6 +151,13 @@ ${project.parent.version} test + + + org.skyscreamer + jsonassert + ${skyscreamer.version} + test + diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/AvroSchemaTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/AvroSchemaTest.java index caeb8ac8393a6..0aa45aff4356b 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/AvroSchemaTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/AvroSchemaTest.java @@ -53,6 +53,8 @@ import org.apache.pulsar.client.impl.schema.SchemaTestUtils.Foo; 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.testng.Assert; import org.testng.annotations.Test; @@ -142,13 +144,17 @@ public void testSchemaDefinition() throws SchemaValidationException { } } + public void assertJSONEquals(String s1, String s2) throws JSONException { + JSONAssert.assertEquals(s1, s2, false); + } + @Test - public void testNotAllowNullSchema() { + public void testNotAllowNullSchema() throws JSONException { AvroSchema avroSchema = AvroSchema.of(SchemaDefinition.builder().withPojo(Foo.class).withAlwaysAllowNull(false).build()); assertEquals(avroSchema.getSchemaInfo().getType(), SchemaType.AVRO); Schema.Parser parser = new Schema.Parser(); String schemaJson = new String(avroSchema.getSchemaInfo().getSchema()); - assertEquals(schemaJson, SCHEMA_AVRO_NOT_ALLOW_NULL); + assertJSONEquals(schemaJson, SCHEMA_AVRO_NOT_ALLOW_NULL); Schema schema = parser.parse(schemaJson); for (String fieldName : FOO_FIELDS) { @@ -165,13 +171,13 @@ public void testNotAllowNullSchema() { } @Test - public void testAllowNullSchema() { + public void testAllowNullSchema() throws JSONException { AvroSchema avroSchema = AvroSchema.of(SchemaDefinition.builder().withPojo(Foo.class).build()); assertEquals(avroSchema.getSchemaInfo().getType(), SchemaType.AVRO); Schema.Parser parser = new Schema.Parser(); parser.setValidateDefaults(false); String schemaJson = new String(avroSchema.getSchemaInfo().getSchema()); - assertEquals(schemaJson, SCHEMA_AVRO_ALLOW_NULL); + assertJSONEquals(schemaJson, SCHEMA_AVRO_ALLOW_NULL); Schema schema = parser.parse(schemaJson); for (String fieldName : FOO_FIELDS) {