You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/10/09 08:29:09 UTC

[flink] branch release-1.9 updated: [FLINK-14335][docs] Fix ExampleIntegrationTest example

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.9
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.9 by this push:
     new 46637f7  [FLINK-14335][docs] Fix ExampleIntegrationTest example
46637f7 is described below

commit 46637f790af74e1a9368975067dcd179d65315df
Author: Yangze Guo <ka...@gmail.com>
AuthorDate: Wed Oct 9 16:26:51 2019 +0800

    [FLINK-14335][docs] Fix ExampleIntegrationTest example
    
    - java version wasn't compiling due to missing ';'
    - java version was checking order of the elements which cannot be guaranteed
    - examples where checking for the wrong results
---
 docs/dev/stream/testing.md    | 12 ++++++------
 docs/dev/stream/testing.zh.md | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/docs/dev/stream/testing.md b/docs/dev/stream/testing.md
index 8992d50..2bd0096 100644
--- a/docs/dev/stream/testing.md
+++ b/docs/dev/stream/testing.md
@@ -44,7 +44,7 @@ public class IncrementMapFunction implements MapFunction<Long, Long> {
 
     @Override
     public Long map(Long record) throws Exception {
-        return record +1 ;
+        return record + 1;
     }
 }
 {% endhighlight %}
@@ -112,7 +112,7 @@ public class IncrementFlatMapFunctionTest {
         Collector<Integer> collector = mock(Collector.class);
 
         // call the methods that you have implemented
-        incrementer.flatMap(2L, collector)
+        incrementer.flatMap(2L, collector);
 
         //verify collector was called with the right output
         Mockito.verify(collector, times(1)).collect(3L);
@@ -216,7 +216,7 @@ public class StatefulFlatMapTest {
         testHarness.setProcessingTime(100L);
 
         //retrieve list of emitted records for assertions
-        assertThat(testHarness.getOutput(), containsInExactlyThisOrder(3L))
+        assertThat(testHarness.getOutput(), containsInExactlyThisOrder(3L));
 
         //retrieve list of records emitted to a specific side output for assertions (ProcessFunction only)
         //assertThat(testHarness.getSideOutput(new OutputTag<>("invalidRecords")), hasSize(0))
@@ -358,7 +358,7 @@ public class IncrementMapFunction implements MapFunction<Long, Long> {
 
     @Override
     public Long map(Long record) throws Exception {
-        return record +1 ;
+        return record + 1;
     }
 }
 {% endhighlight %}
@@ -410,7 +410,7 @@ public class ExampleIntegrationTest {
         env.execute();
 
         // verify your results
-        assertEquals(Lists.newArrayList(2L, 42L, 44L), CollectSink.values);
+        assertTrue(CollectSink.values.containsAll(2L, 22L, 23L));
     }
 
     // create a testing sink
@@ -465,7 +465,7 @@ class StreamingJobIntegrationTest extends FlatSpec with Matchers with BeforeAndA
     env.execute()
 
     // verify your results
-    CollectSink.values should contain allOf (1,22,23)
+    CollectSink.values should contain allOf (2, 22, 23)
     }
 }
 // create a testing sink
diff --git a/docs/dev/stream/testing.zh.md b/docs/dev/stream/testing.zh.md
index 01c7808..2264ec4 100644
--- a/docs/dev/stream/testing.zh.md
+++ b/docs/dev/stream/testing.zh.md
@@ -44,7 +44,7 @@ public class IncrementMapFunction implements MapFunction<Long, Long> {
 
     @Override
     public Long map(Long record) throws Exception {
-        return record +1 ;
+        return record + 1;
     }
 }
 {% endhighlight %}
@@ -112,7 +112,7 @@ public class IncrementFlatMapFunctionTest {
         Collector<Integer> collector = mock(Collector.class);
 
         // call the methods that you have implemented
-        incrementer.flatMap(2L, collector)
+        incrementer.flatMap(2L, collector);
 
         //verify collector was called with the right output
         Mockito.verify(collector, times(1)).collect(3L);
@@ -216,7 +216,7 @@ public class StatefulFlatMapTest {
         testHarness.setProcessingTime(100L);
 
         //retrieve list of emitted records for assertions
-        assertThat(testHarness.getOutput(), containsInExactlyThisOrder(3L))
+        assertThat(testHarness.getOutput(), containsInExactlyThisOrder(3L));
 
         //retrieve list of records emitted to a specific side output for assertions (ProcessFunction only)
         //assertThat(testHarness.getSideOutput(new OutputTag<>("invalidRecords")), hasSize(0))
@@ -358,7 +358,7 @@ public class IncrementMapFunction implements MapFunction<Long, Long> {
 
     @Override
     public Long map(Long record) throws Exception {
-        return record +1 ;
+        return record + 1;
     }
 }
 {% endhighlight %}
@@ -410,7 +410,7 @@ public class ExampleIntegrationTest {
         env.execute();
 
         // verify your results
-        assertEquals(Lists.newArrayList(2L, 42L, 44L), CollectSink.values);
+        assertTrue(CollectSink.values.containsAll(2L, 22L, 23L));
     }
 
     // create a testing sink
@@ -465,7 +465,7 @@ class StreamingJobIntegrationTest extends FlatSpec with Matchers with BeforeAndA
     env.execute()
 
     // verify your results
-    CollectSink.values should contain allOf (1,22,23)
+    CollectSink.values should contain allOf (2, 22, 23)
     }
 }
 // create a testing sink