diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java index dab9d08ac143e..29b386eb7e748 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java @@ -658,9 +658,12 @@ public void testNullKeyValueProperty() throws PulsarAdminException, PulsarClient final Map map = new HashMap<>(); map.put("key", null); map.put(null, "value"); // null key is not allowed for JSON, it's only for test here - ((SchemaInfoImpl)Schema.INT32.getSchemaInfo()).setProperties(map); - final Consumer consumer = pulsarClient.newConsumer(Schema.INT32).topic(topic) + // leave INT32 instance unchanged + final Schema integerSchema = Schema.INT32.clone(); + ((SchemaInfoImpl) integerSchema.getSchemaInfo()).setProperties(map); + + final Consumer consumer = pulsarClient.newConsumer(integerSchema).topic(topic) .subscriptionName("sub") .subscribe(); consumer.close();