jlprat commented on a change in pull request #11241: URL: https://github.com/apache/kafka/pull/11241#discussion_r695017818
########## File path: streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFlatMapTest.java ########## @@ -86,4 +88,10 @@ public void testFlatMap() { assertEquals(expected[i], supplier.theCapturedProcessor().processed().get(i)); } } + + @Test + public void testKeyValueMapperResultNotNull() { + final KStreamFlatMap<String, Integer, String, Integer> supplier = new KStreamFlatMap<>((key, value) -> null); + assertThrows(NullPointerException.class, () -> supplier.get().process(new Record<>("K", 0, 0L))); Review comment: Actually I was wrong with my code suggestion, the overloaded method doesn't do what I expected it to do. The message it takes is only to print if the assertion fails. That should do the trick! ``` final Throwable throwable = assertThrows(String.format("KeyValueMapper can't return null from mapping the record: %s", record), NullPointerException.class, () -> supplier.get().process(record)); assertEquals(throwable.getMessage(), String.format("KeyValueMapper can't return null from mapping the record: %s", record)); ``` Sorry about the confusion I brought with the first comment -- 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