You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by mj...@apache.org on 2021/06/28 22:33:24 UTC

[kafka] branch trunk updated: KAFKA-12909: add missing tests (#10893)

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

mjsax 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 2540b77  KAFKA-12909: add missing tests (#10893)
2540b77 is described below

commit 2540b777695b2e90d353e81e970012f9a9aecc44
Author: Matthias J. Sax <ma...@confluent.io>
AuthorDate: Mon Jun 28 15:32:16 2021 -0700

    KAFKA-12909: add missing tests (#10893)
    
    Reviewers: A. Sophie Blee-Goldman <so...@confluent.io>
---
 .../kafka/streams/kstream/JoinWindowsTest.java      | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/streams/src/test/java/org/apache/kafka/streams/kstream/JoinWindowsTest.java b/streams/src/test/java/org/apache/kafka/streams/kstream/JoinWindowsTest.java
index d3f84be..cf9b6d6c 100644
--- a/streams/src/test/java/org/apache/kafka/streams/kstream/JoinWindowsTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/kstream/JoinWindowsTest.java
@@ -19,8 +19,11 @@ package org.apache.kafka.streams.kstream;
 import org.junit.Test;
 
 import static java.time.Duration.ofMillis;
+import static java.time.Duration.ofSeconds;
 import static org.apache.kafka.streams.EqualityCheck.verifyEquality;
 import static org.apache.kafka.streams.EqualityCheck.verifyInEquality;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.fail;
@@ -46,6 +49,24 @@ public class JoinWindowsTest {
     }
 
     @Test
+    public void beforeShouldNotModifyGrace() {
+        final JoinWindows joinWindows = JoinWindows.of(ofMillis(ANY_SIZE))
+            .grace(ofMillis(ANY_OTHER_SIZE))
+            .before(ofSeconds(ANY_SIZE));
+
+        assertThat(joinWindows.gracePeriodMs(), equalTo(ANY_OTHER_SIZE));
+    }
+
+    @Test
+    public void afterShouldNotModifyGrace() {
+        final JoinWindows joinWindows = JoinWindows.of(ofMillis(ANY_SIZE))
+            .grace(ofMillis(ANY_OTHER_SIZE))
+            .after(ofSeconds(ANY_SIZE));
+
+        assertThat(joinWindows.gracePeriodMs(), equalTo(ANY_OTHER_SIZE));
+    }
+
+    @Test
     public void timeDifferenceMustNotBeNegative() {
         assertThrows(IllegalArgumentException.class, () -> JoinWindows.of(ofMillis(-1)));
     }