FrankYang0529 commented on code in PR #19357:
URL: https://github.com/apache/kafka/pull/19357#discussion_r2028360352


##########
server/src/test/java/org/apache/kafka/server/share/fetch/ShareFetchTest.java:
##########
@@ -66,6 +79,19 @@ public void testErrorInAllPartitions() {
         assertTrue(shareFetch.errorInAllPartitions());
     }
 
+    @Test
+    public void testDontCacheAnyData() {
+        ShareFetchResponse shareFetch = shareFetchResponse(tidp0, records, 
Errors.NONE, "", (short) 0,
+                "", List.of(), 0);
+        LinkedHashMap<TopicIdPartition, ShareFetchResponseData.PartitionData> 
responseData = shareFetch.responseData(Map.of(tidp0.topicId(), tidp0.topic()));
+        assertEquals(1, responseData.size());
+        responseData.forEach((topicIdPartition, partitionData) -> 
assertEquals(records, partitionData.records()));
+
+        LinkedHashMap<TopicIdPartition, ShareFetchResponseData.PartitionData> 
nonResponseData = shareFetch.responseData(Map.of());
+        assertEquals(0, nonResponseData.size());
+        nonResponseData.forEach((topicIdPartition, partitionData) -> 
assertEquals(MemoryRecords.EMPTY, partitionData.records()));

Review Comment:
   If `nonResponseData` size is 0, the assertion for data inside it will not be 
executed. Do we still need this line? 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

Reply via email to