Jiabao-Sun commented on code in PR #24483:
URL: https://github.com/apache/flink/pull/24483#discussion_r1524259645


##########
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/TumblingProcessingTimeWindowsTest.java:
##########
@@ -151,53 +132,44 @@ public void testTimeUnits() {
                 TumblingProcessingTimeWindows.of(Time.seconds(5), 
Time.seconds(1));
 
         when(mockContext.getCurrentProcessingTime()).thenReturn(1000L);
-        assertThat(
-                assigner.assignWindows("String", Long.MIN_VALUE, mockContext),
-                contains(timeWindow(1000, 6000)));
+        assertThat(assigner.assignWindows("String", Long.MIN_VALUE, 
mockContext))
+                .contains(new TimeWindow(1000, 6000));
 
         when(mockContext.getCurrentProcessingTime()).thenReturn(5999L);
-        assertThat(
-                assigner.assignWindows("String", Long.MIN_VALUE, mockContext),
-                contains(timeWindow(1000, 6000)));
+        assertThat(assigner.assignWindows("String", Long.MIN_VALUE, 
mockContext))
+                .contains(new TimeWindow(1000, 6000));
 
         when(mockContext.getCurrentProcessingTime()).thenReturn(6000L);
-        assertThat(
-                assigner.assignWindows("String", Long.MIN_VALUE, mockContext),
-                contains(timeWindow(6000, 11000)));
+        assertThat(assigner.assignWindows("String", Long.MIN_VALUE, 
mockContext))
+                .contains(new TimeWindow(6000, 11000));
     }
 
     @Test
-    public void testInvalidParameters() {
-        try {
-            TumblingProcessingTimeWindows.of(Time.seconds(-1));
-            fail("should fail");
-        } catch (IllegalArgumentException e) {
-            assertThat(e.toString(), containsString("abs(offset) < size"));
-        }
-
-        try {
-            TumblingProcessingTimeWindows.of(Time.seconds(10), 
Time.seconds(20));
-            fail("should fail");
-        } catch (IllegalArgumentException e) {
-            assertThat(e.toString(), containsString("abs(offset) < size"));
-        }
-
-        try {
-            TumblingProcessingTimeWindows.of(Time.seconds(10), 
Time.seconds(-11));
-            fail("should fail");
-        } catch (IllegalArgumentException e) {
-            assertThat(e.toString(), containsString("abs(offset) < size"));
-        }
+    void testInvalidParameters() {
+
+        assertThatThrownBy(() -> 
TumblingProcessingTimeWindows.of(Time.seconds(-1)))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessageContaining("TumblingProcessingTimeWindows");

Review Comment:
   Thanks.
   I'll change the usage of deprecated `Time` to `Duration` as well.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to