loicgreffier commented on code in PR #16432:
URL: https://github.com/apache/kafka/pull/16432#discussion_r1687791774


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/RecordDeserializerTest.java:
##########
@@ -69,17 +85,76 @@ public void 
shouldReturnConsumerRecordWithDeserializedValueWhenNoExceptions() {
         assertEquals(rawRecord.headers(), record.headers());
     }
 
+    @ParameterizedTest
+    @CsvSource({
+        "true, false",
+        "false, true"
+    })
+    public void 
shouldThrowStreamsExceptionWhenDeserializationFailsAndDeserializationExceptionHandlerRepliesWithFail(final
 boolean keyThrowsException,
+                                                                               
                                      final boolean valueThrowsException) {
+        final RecordDeserializer recordDeserializer = new RecordDeserializer(
+            new TheSourceNode(
+                sourceNodeName,
+                keyThrowsException,
+                valueThrowsException,
+                "key",
+                "value"
+            ),
+            new DeserializationExceptionHandlerMock(
+                
DeserializationExceptionHandler.DeserializationHandlerResponse.FAIL,
+                rawRecord,
+                sourceNodeName,
+                taskId
+            ),
+            new LogContext(),
+            new Metrics().sensor("dropped-records")
+        );
+
+        final StreamsException e = assertThrows(StreamsException.class, () -> 
recordDeserializer.deserialize(context, rawRecord));
+        assertEquals(e.getMessage(), "Deserialization exception handler is set 
to fail upon a deserialization error. If you would rather have the streaming 
pipeline continue after a deserialization error, please set the 
default.deserialization.exception.handler appropriately.");
+    }
+
+    @ParameterizedTest
+    @CsvSource({
+        "true, false",
+        "false, true"

Review Comment:
   `true, true` should fail and exit on the deserialization of the key just 
like `true, false`. As the test is parametized, it does not cost so much to add 
this scenario.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to