lct45 commented on a change in pull request #9039: URL: https://github.com/apache/kafka/pull/9039#discussion_r465193735
########## File path: streams/src/test/java/org/apache/kafka/streams/kstream/SlidingWindowsTest.java ########## @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.streams.kstream; + +import org.junit.Test; + +import static java.time.Duration.ofMillis; +import static org.apache.kafka.streams.EqualityCheck.verifyEquality; +import static org.apache.kafka.streams.EqualityCheck.verifyInEquality; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.fail; + +@SuppressWarnings("deprecation") +public class SlidingWindowsTest { + + private static final long ANY_SIZE = 123L; + + @Test + public void shouldSetWindowSize() { + assertEquals(ANY_SIZE, SlidingWindows.withTimeDifferenceAndGrace(ofMillis(ANY_SIZE), ofMillis(3)).timeDifferenceMs()); + } + + @Test(expected = IllegalArgumentException.class) + public void windowSizeMustNotBeZero() { + SlidingWindows.withTimeDifferenceAndGrace(ofMillis(0), ofMillis(5)); + } + + @Test(expected = IllegalArgumentException.class) + public void windowSizeMustNotBeNegative() { + SlidingWindows.withTimeDifferenceAndGrace(ofMillis(-1), ofMillis(5)); Review comment: I think just confirming that the correct error will be thrown when someone sets a `timeDifference` we don't want. I'll update all the `windowSize` to be `timeDifference` and I agree, no need to check that it isn't 0 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org