This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 9f676dd7e23 MINOR: Clean up unreachable code in FetcherTest (#19376)
9f676dd7e23 is described below
commit 9f676dd7e239ac53061f3dd6a56bd9f8e366b7c1
Author: Parker Chang <[email protected]>
AuthorDate: Sun Apr 6 22:17:02 2025 +0800
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]>
---
.../org/apache/kafka/clients/consumer/internals/FetcherTest.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git
a/clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java
b/clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java
index 483b54e5f43..45a747e04da 100644
---
a/clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java
+++
b/clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java
@@ -3662,9 +3662,8 @@ public class FetcherTest {
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()));
+ LinkedHashMap<TopicPartition, FetchResponseData.PartitionData>
nonResponseData = fetchResponse.responseData(Map.of(), version);
+ assertTrue(nonResponseData.isEmpty());
}
private OffsetsForLeaderEpochResponse prepareOffsetsForLeaderEpochResponse(