chia7712 commented on code in PR #19812: URL: https://github.com/apache/kafka/pull/19812#discussion_r2107630603
########## clients/src/test/java/org/apache/kafka/test/MockDeserializer.java: ########## @@ -52,11 +53,14 @@ public void configure(Map<String, ?> configs, boolean isKey) { } @Override - public byte[] deserialize(String topic, byte[] data) { + public String deserialize(String topic, byte[] data) { // This will ensure that we get the cluster metadata when deserialize is called for the first time // as subsequent compareAndSet operations will fail. clusterIdBeforeDeserialize.compareAndSet(noClusterId, clusterMeta.get()); - return data; + if (data == null) Review Comment: ```java if (data == null) return null; return data.getBytes(StandardCharsets.UTF_8); ``` ########## clients/src/test/java/org/apache/kafka/test/MockSerializer.java: ########## @@ -35,11 +36,14 @@ public MockSerializer() { } @Override - public byte[] serialize(String topic, byte[] data) { + public byte[] serialize(String topic, String data) { // This will ensure that we get the cluster metadata when serialize is called for the first time // as subsequent compareAndSet operations will fail. CLUSTER_ID_BEFORE_SERIALIZE.compareAndSet(NO_CLUSTER_ID, CLUSTER_META.get()); - return data; + if (data == null) Review Comment: ditto ########## clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java: ########## @@ -603,7 +603,7 @@ public void testSerializerClose() { final int oldInitCount = MockSerializer.INIT_COUNT.get(); final int oldCloseCount = MockSerializer.CLOSE_COUNT.get(); - KafkaProducer<byte[], byte[]> producer = new KafkaProducer<>( + KafkaProducer<String, String> producer = new KafkaProducer<>( Review Comment: ```java try (var ignored = new KafkaProducer<>(configs, new MockSerializer(), new MockSerializer())) { assertEquals(oldInitCount + 2, MockSerializer.INIT_COUNT.get()); assertEquals(oldCloseCount, MockSerializer.CLOSE_COUNT.get()); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org