beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [7/8] beam git commit: [BEAM-1186] Brought back some missing test cases involving with NO_LINES.
Date Wed, 28 Dec 2016 19:41:40 GMT
[BEAM-1186] Brought back some missing test cases involving with NO_LINES.


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/43789aae
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/43789aae
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/43789aae

Branch: refs/heads/master
Commit: 43789aae2009b1302e990c7ffd730aec0c49699d
Parents: 7302732
Author: Stas Levin <staslevin@gmail.com>
Authored: Wed Dec 28 19:53:35 2016 +0200
Committer: Luke Cwik <lcwik@google.com>
Committed: Wed Dec 28 11:40:33 2016 -0800

----------------------------------------------------------------------
 .../apache/beam/sdk/transforms/SampleTest.java  | 33 ++++++++++++++------
 1 file changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/43789aae/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
index 4e3b31c..e21e07b 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/SampleTest.java
@@ -18,7 +18,6 @@
 package org.apache.beam.sdk.transforms;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static org.apache.beam.sdk.TestUtils.LINES;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.hasDisplayItem;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
@@ -33,6 +32,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
+import org.apache.beam.sdk.TestUtils;
 import org.apache.beam.sdk.coders.BigEndianIntegerCoder;
 import org.apache.beam.sdk.coders.StringUtf8Coder;
 import org.apache.beam.sdk.testing.PAssert;
@@ -69,36 +69,51 @@ public class SampleTest {
     @Rule
     public final transient TestPipeline p = TestPipeline.create();
 
-    @Parameterized.Parameters(name = "limit_{0}")
+    @Parameterized.Parameters(name = "limit_{1}")
     public static Iterable<Object[]> data() throws IOException {
       return ImmutableList.<Object[]>builder()
           .add(
               new Object[] {
+                  TestUtils.NO_LINES,
                   0
               },
               new Object[] {
+                  TestUtils.NO_LINES,
                   1
               },
               new Object[] {
-                  LINES.size() / 2
+                  TestUtils.LINES,
+                  1
+              },
+              new Object[] {
+                  TestUtils.LINES,
+                  TestUtils.LINES.size() / 2
               },
               new Object[] {
-                  LINES.size() * 2
+                  TestUtils.LINES,
+                  TestUtils.LINES.size() * 2
               },
               new Object[] {
-                  LINES.size() - 1
+                  TestUtils.LINES,
+                  TestUtils.LINES.size() - 1
               },
               new Object[] {
-                  LINES.size()
+                  TestUtils.LINES,
+                  TestUtils.LINES.size()
               },
               new Object[] {
-                  LINES.size() + 1
+                  TestUtils.LINES,
+                  TestUtils.LINES.size() + 1
               }
               )
           .build();
     }
 
-    @Parameterized.Parameter
+    @SuppressWarnings("DefaultAnnotationParam")
+    @Parameterized.Parameter(0)
+    public List<String> lines;
+
+    @Parameterized.Parameter(1)
     public int limit;
 
     private static class VerifyAnySample implements SerializableFunction<Iterable<String>,
Void> {
@@ -149,7 +164,7 @@ public class SampleTest {
     @Test
     @Category(RunnableOnService.class)
     public void testPickAny() {
-      runPickAnyTest(LINES, limit);
+      runPickAnyTest(lines, limit);
     }
   }
 


Mime
View raw message