jasonyanwenl commented on a change in pull request #11241: URL: https://github.com/apache/kafka/pull/11241#discussion_r696210814
########## File path: streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamFlatMapTest.java ########## @@ -86,4 +88,12 @@ 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); + final Record<String, Integer> record = new Record<>("K", 0, 0L); + final Throwable throwable = assertThrows(NullPointerException.class, () -> supplier.get().process(record)); + assertEquals(throwable.getMessage(), String.format("KeyValueMapper can't return null from mapping the record: %s", record)); Review comment: 1. Just curious, why preferred `assertThat` from `hamcrest`? I saw in our code base, different places use `junit` / `hamcrest`. Any rule for guiding when to use which framework? 2. Other testing in this file are using `junit`. So if I only use `hamcrest` in this single place, this class will import both `junit` and `hamcrest` and mix the using of those two. I think this is a bit ugly LOL. Do you suggest updating all to using `hamcrest`? Thanks! -- 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