Skip to content

Commit

Permalink
KAFKA-12323 Follow-up: Refactor the unit test a bit (#10205)
Browse files Browse the repository at this point in the history
Reviewers: Matthias J. Sax <matthias@confluent.io>
  • Loading branch information
guozhangwang committed Mar 1, 2021
1 parent 3f76293 commit 23f9774
Showing 1 changed file with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1844,19 +1844,17 @@ public void process(final Object key, final Object value) {}
assertEquals(0, punctuatedWallClockTime.size());

mockTime.sleep(100L);
for (long i = 0L; i < 10L; i++) {
clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
i,
i * 100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
("K" + i).getBytes().length,
("V" + i).getBytes().length,
("K" + i).getBytes(),
("V" + i).getBytes()));
}
clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
100L,
100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));

thread.runOnce();

Expand Down Expand Up @@ -1936,19 +1934,19 @@ public void process(final Object key, final Object value) {
clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
0L,
100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));
110L,
110L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));

thread.runOnce();

assertEquals(2, peekedContextTime.size());
assertEquals(0L, peekedContextTime.get(1).longValue());
assertEquals(110L, peekedContextTime.get(1).longValue());
}

@Test
Expand Down

0 comments on commit 23f9774

Please sign in to comment.