Skip to content

Commit 9f676dd

Browse files
authored
MINOR: Clean up unreachable code in FetcherTest (#19376)
This is from [#16532's comment](https://github.com/apache/kafka/pull/16532/files#r2028985028): The forEach loop in the assertion will never execute because `nonResponseData` is empty. This happens because the above assertion `emptyMap()` has a size of 0, so there are no elements to iterate over. Reviewers: PoAn Yang <[email protected]>, Ken Huang <[email protected]>, TaiJuWu <[email protected]>, TengYao Chi <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent ab4a0f0 commit 9f676dd

File tree

1 file changed

+2
-3
lines changed
  • clients/src/test/java/org/apache/kafka/clients/consumer/internals

1 file changed

+2
-3
lines changed

clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -3662,9 +3662,8 @@ public void testFetcherDontCacheAnyData() {
36623662
LinkedHashMap<TopicPartition, FetchResponseData.PartitionData> responseData = fetchResponse.responseData(topicNames, version);
36633663
assertEquals(topicNames.size(), responseData.size());
36643664
responseData.forEach((topicPartition, partitionData) -> assertEquals(records, partitionData.records()));
3665-
LinkedHashMap<TopicPartition, FetchResponseData.PartitionData> nonResponseData = fetchResponse.responseData(emptyMap(), version);
3666-
assertEquals(emptyMap().size(), nonResponseData.size());
3667-
nonResponseData.forEach((topicPartition, partitionData) -> assertEquals(MemoryRecords.EMPTY, partitionData.records()));
3665+
LinkedHashMap<TopicPartition, FetchResponseData.PartitionData> nonResponseData = fetchResponse.responseData(Map.of(), version);
3666+
assertTrue(nonResponseData.isEmpty());
36683667
}
36693668

36703669
private OffsetsForLeaderEpochResponse prepareOffsetsForLeaderEpochResponse(

0 commit comments

Comments
 (0)