add missing tests
Reviewers: A. Sophie Blee-Goldman
@@ -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;
@@ -45,6 +48,24 @@ public class JoinWindowsTest {
.after(ofMillis(-ANY_OTHER_SIZE)); // [ -anyOtherSize ; -anyOtherSize ]
}
+ @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)));
