Skip to content

Commit 56275ea

Browse files
LucasEbysrinath-ctds
authored andcommitted
[fix][test] Fixed Nondeterministic Ordering in SchemaInfoTest (apache#24969)
(cherry picked from commit 8f357b0) (cherry picked from commit de4c613)
1 parent 4717091 commit 56275ea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pulsar-client/src/test/java/org/apache/pulsar/client/impl/schema/SchemaInfoTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import org.apache.pulsar.common.schema.KeyValueEncodingType;
2626
import org.apache.pulsar.common.schema.SchemaInfo;
2727
import org.apache.pulsar.common.schema.SchemaType;
28+
import org.json.JSONException;
29+
import org.skyscreamer.jsonassert.JSONAssert;
30+
import org.skyscreamer.jsonassert.JSONCompareMode;
2831
import org.testng.annotations.DataProvider;
2932
import org.testng.annotations.Test;
3033

@@ -289,8 +292,8 @@ public static Object[][] schemas() {
289292
}
290293

291294
@Test(dataProvider = "schemas")
292-
public void testSchemaInfoToString(SchemaInfo si, String jsonifiedStr) {
293-
assertEquals(si.toString(), jsonifiedStr);
295+
public void testSchemaInfoToString(SchemaInfo si, String jsonifiedStr) throws JSONException {
296+
JSONAssert.assertEquals(si.toString(), jsonifiedStr, JSONCompareMode.NON_EXTENSIBLE);
294297
}
295298

296299
public static class SchemaInfoBuilderTest {
@@ -327,7 +330,7 @@ public void testSetProperties() {
327330
}
328331

329332
@Test
330-
public void testNullPropertyValue() {
333+
public void testNullPropertyValue() throws JSONException {
331334
final Map<String, String> map = new HashMap<>();
332335
map.put("key", null);
333336

@@ -339,7 +342,7 @@ public void testNullPropertyValue() {
339342
.build();
340343

341344
// null key will be skipped by Gson when serializing JSON to String
342-
assertEquals(si.toString(), INT32_SCHEMA_INFO);
345+
JSONAssert.assertEquals(si.toString(), INT32_SCHEMA_INFO, JSONCompareMode.NON_EXTENSIBLE);
343346
}
344347
}
345348
}

0 commit comments

Comments
 (0)