Chia-Ping Tsai created KAFKA-21121:
--------------------------------------

             Summary: shouldBeEqualsIfOnlyDifferInCommittedOffsets and 
shouldBeEqualsIfOnlyDifferInEndOffsets don't test what they want
                 Key: KAFKA-21121
                 URL: https://issues.apache.org/jira/browse/KAFKA-21121
             Project: Kafka
          Issue Type: Test
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


{code:java}
    public static final Map<TopicPartition, Long> COMMITTED_OFFSETS = 
mkMap(mkEntry(TP_1, 1L), mkEntry(TP_1, 2L));
    public static final Map<TopicPartition, Long> END_OFFSETS = 
mkMap(mkEntry(TP_1, 1L), mkEntry(TP_1, 3L)); {code}
COMMITTED_OFFSETS and END_OFFSETS should have two items, but they use {{TP_1}} 
for both keys. shouldBeEqualsIfOnlyDifferInCommittedOffsets and 
shouldBeEqualsIfOnlyDifferInEndOffsets have the same typo. As a result, the 
committed offsets in shouldBeEqualsIfOnlyDifferInCommittedOffsets end up 
identical to COMMITTED_OFFSETS, which violates the test scenario. 
shouldBeEqualsIfOnlyDifferInEndOffsets still passes with different values, but 
only by luck.

BTW, we should leverage Map.of to avoid similar typo in the future 😊



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to