jlprat commented on a change in pull request #11241:
URL: https://github.com/apache/kafka/pull/11241#discussion_r695019986



##########
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);
+        assertThrows(String.format("KeyValueMapper can't return null from 
mapping the record: %s", record),
+                NullPointerException.class, () -> 
supplier.get().process(record));

Review comment:
       Just copying over the suggestion to here, so it's easy to find
   
   ```suggestion
          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));
   ```




-- 
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


Reply via email to