FrankYang0529 commented on code in PR #16532: URL: https://github.com/apache/kafka/pull/16532#discussion_r2028985028
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java: ########## @@ -3665,6 +3670,18 @@ public void testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInform // Validate subscription is still valid & fetch-able for tp1. assertTrue(subscriptions.isFetchable(tp1)); } + + @Test + public void testFetcherDontCacheAnyData() { + short version = 17; + FetchResponse fetchResponse = fetchResponse(tidp0, records, Errors.NONE, 100L, -1L, 0L, 0); + LinkedHashMap<TopicPartition, FetchResponseData.PartitionData> responseData = fetchResponse.responseData(topicNames, version); + assertEquals(topicNames.size(), responseData.size()); + responseData.forEach((topicPartition, partitionData) -> assertEquals(records, partitionData.records())); + LinkedHashMap<TopicPartition, FetchResponseData.PartitionData> nonResponseData = fetchResponse.responseData(emptyMap(), version); + assertEquals(emptyMap().size(), nonResponseData.size()); + nonResponseData.forEach((topicPartition, partitionData) -> assertEquals(MemoryRecords.EMPTY, partitionData.records())); Review Comment: This line is never executed. We can remove this assertion. -- 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