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


##########
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:
   I found that in many test classes contain Time, I think it should be 
uniformly removed in Flink 2.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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to