kl0u commented on a change in pull request #13828:
URL: https://github.com/apache/flink/pull/13828#discussion_r513675008
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/source/SourceOperatorEventTimeTest.java
##########
@@ -133,24 +158,37 @@ public void testPerSplitOutputEventWatermarks() throws
Exception {
(output) ->
output.createOutputForSplit("two").collect(0, 200L)
);
- assertThat(result, contains(
- new Watermark(100L),
- new Watermark(150L),
- new Watermark(200L)
- ));
+ assertWatermarksOrEmpty(
+ result,
+ new Watermark(100L),
+ new Watermark(150L),
+ new Watermark(200L));
}
//
------------------------------------------------------------------------
// test execution helpers
//
------------------------------------------------------------------------
+ /**
+ * Asserts that the given expected watermarks are present in the actual
watermarks in STREAMING
+ * mode. Otherwise, asserts that the list of actual watermarks is empty
in BATCH mode.
+ */
+ private void assertWatermarksOrEmpty(List<Watermark> actualWatermarks,
Watermark... expectedWatermarks) {
+ if (runtimeMode == SourceOperator.RuntimeMode.STREAMING) {
+ assertThat(actualWatermarks,
contains(expectedWatermarks));
+ } else {
+ assertThat(actualWatermarks, empty());
+ }
+ }
+
@SuppressWarnings("FinalPrivateMethod")
@SafeVarargs
private final List<Watermark> testSequenceOfWatermarks(
+ SourceOperator.RuntimeMode runtimeMode,
Review comment:
Just for uniformity I would add the `final`
----------------------------------------------------------------
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