You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gu...@apache.org on 2021/03/01 20:14:05 UTC

[kafka] branch 2.8 updated: KAFKA-12323 Follow-up: Refactor the unit test a bit (#10205)

This is an automated email from the ASF dual-hosted git repository.

guozhang pushed a commit to branch 2.8
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.8 by this push:
     new 23f9774  KAFKA-12323 Follow-up: Refactor the unit test a bit (#10205)
23f9774 is described below

commit 23f977461eb850f3218c619915df80214c17bc43
Author: Guozhang Wang <wa...@gmail.com>
AuthorDate: Mon Mar 1 12:11:11 2021 -0800

    KAFKA-12323 Follow-up: Refactor the unit test a bit (#10205)
    
    Reviewers: Matthias J. Sax <ma...@confluent.io>
---
 .../processor/internals/StreamThreadTest.java      | 42 +++++++++++-----------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamThreadTest.java b/streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamThreadTest.java
index e2b1549..3043423 100644
--- a/streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamThreadTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamThreadTest.java
@@ -1844,19 +1844,17 @@ public class StreamThreadTest {
         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();
 
@@ -1936,19 +1934,19 @@ public class StreamThreadTest {
         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