frankvicky commented on code in PR #16227: URL: https://github.com/apache/kafka/pull/16227#discussion_r1630620777
########## clients/src/test/java/org/apache/kafka/clients/consumer/ConsumerRecordsTest.java: ########## @@ -59,4 +50,47 @@ public void iterator() throws Exception { } assertEquals(2, c); } + + @Test + public void testRecordsWithNullTopic() { + String nullTopic = null; + Map<TopicPartition, List<ConsumerRecord<Integer, String>>> records = new LinkedHashMap<>(); + ConsumerRecords<Integer, String> consumerRecords = new ConsumerRecords<>(records); + IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> consumerRecords.records(nullTopic)); + assertEquals("Topic must be non-null.", exception.getMessage()); + } + + @Test + public void testRecords() { + String targetTopic = "topic"; + Map<TopicPartition, List<ConsumerRecord<Integer, String>>> records = buildTestRecordsWithDummyRecords(targetTopic); Review Comment: Sure, will do it 😸 -- 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