changeset 5872:debae4fe344f it2-bootstrap

Uplevel StreamOpTestCase to deal with different types of stream sources
author briangoetz
date Tue, 28 Aug 2012 16:52:28 -0400
parents ef17a5d81036
children e4e2682c1d16 cb9b22657243
files src/share/classes/java/util/Arrays.java test-ng/tests/org/openjdk/tests/java/util/streams/StreamTestDataProvider.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/CumulateOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/FilterOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/FlatMapOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/GroupByOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/MapOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/SortedOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/StreamOpTestCase.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java test-ng/tests/org/openjdk/tests/java/util/streams/ops/UniqOpTest.java
diffstat 11 files changed, 193 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Arrays.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/src/share/classes/java/util/Arrays.java	Tue Aug 28 16:52:28 2012 -0400
@@ -3885,7 +3885,7 @@
     }
 
     public static<T> Stream<T> parallel(T[] array, int offset, int length) {
-        return Streams.parallel(new ArrayParallelStreamAccessor<>(array, offset, length));
+        return Streams.parallel(new ArrayParallelStreamAccessor<>(array, offset, length), length);
     }
 
     public static<T> Streamable<T> asStreamable(final T[] array, final int offset, final int length) {
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/StreamTestDataProvider.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/StreamTestDataProvider.java	Tue Aug 28 16:52:28 2012 -0400
@@ -27,6 +27,13 @@
 import org.openjdk.tests.java.util.LambdaTestHelpers;
 import org.testng.annotations.DataProvider;
 
+import java.util.*;
+import java.util.functions.Sink;
+import java.util.streams.LinearPipeline;
+import java.util.streams.Stream;
+import java.util.streams.ops.IntermediateOp;
+import java.util.streams.ops.TerminalOp;
+
 /**
  * StreamTestDataProvider
  *
@@ -43,6 +50,8 @@
     private static final Integer[] twice = new Integer[200];
     private static final Integer[] pseudoRandom;
 
+    private static final Object[][] testData;
+
     static {
         Integer[][] arrays = {to0, to1, to10, to100, to1000};
         for (Integer[] arr : arrays) {
@@ -64,18 +73,144 @@
         }
     }
 
-    // Return an array of Integer[]
+    static Object[][] arrays = {
+            {"empty", to0},
+            {"0..1", to1},
+            {"0..10", to10},
+            {"0..100", to100},
+            {"0..1000", to1000},
+            {"100x[1]", ones},
+            {"2x[0..100]", twice},
+            {"reverse 0..100", reversed},
+            {"pseudorandom", pseudoRandom}
+    };
+
+    static {
+        List<Object[]> list = new ArrayList<>();
+        for (Object[] data : arrays) {
+            list.add(new Object[] { "array:" + data[0], new ArrayTestData<>((Integer[]) data[1])});
+            list.add(new Object[] { "ArrayList:" + data[0], new CollectionTestData<>(new ArrayList<>(Arrays.asList((Integer[]) data[1]))) });
+            list.add(new Object[] { "TreeSet:" + data[0], new CollectionTestData<>(new TreeSet<>(Arrays.asList((Integer[]) data[1]))) });
+        }
+        testData = list.toArray(new Object[0][]);
+    }
+
+    public static interface TestData<T> {
+        Stream<T> seq();
+        Stream<T> par();
+        Iterator<T> iterator();
+        Spliterator<T> spliterator();
+        void forEach(Sink<? super T> sink);
+        int size();
+
+        <U> Stream<U> seq(IntermediateOp<T,U> op) default {
+            return ((LinearPipeline<T,T>) seq()).pipeline(op);
+        }
+
+        <U> Stream<U> par(IntermediateOp<T,U> op) default {
+            return ((LinearPipeline<T,T>) par()).pipeline(op);
+        }
+
+        <U> U seq(TerminalOp<T,U> op) default {
+            return ((LinearPipeline<T,T>) seq()).pipeline(op);
+        }
+
+        <U> U par(TerminalOp<T,U> op) default {
+            return ((LinearPipeline<T,T>) par()).pipeline(op);
+        }
+    }
+
+    public static class ArrayTestData<T> implements TestData<T> {
+        private final T[] array;
+
+        public ArrayTestData(T[] array) {
+            this.array = array;
+        }
+
+        @Override
+        public Stream<T> seq() {
+            return Arrays.stream(array);
+        }
+
+        @Override
+        public Stream<T> par() {
+            return Arrays.parallel(array);
+        }
+
+        @Override
+        public Iterator<T> iterator() {
+            return Arrays.iterator(array);
+        }
+
+        @Override
+        public Spliterator<T> spliterator() {
+            return Arrays.spliterator(array);
+        }
+
+        @Override
+        public void forEach(Sink<? super T> sink) {
+            for (T t : array)
+                sink.accept(t);
+        }
+
+        @Override
+        public int size() {
+            return array.length;
+        }
+
+        @Override
+        public String toString() {
+            return Arrays.toString(array);
+        }
+    }
+
+    public static class CollectionTestData<T> implements TestData<T> {
+        private final Collection<T> collection;
+
+        public CollectionTestData(Collection<T> collection) {
+            this.collection = collection;
+        }
+
+        @Override
+        public Stream<T> seq() {
+            return collection.stream();
+        }
+
+        @Override
+        public Stream<T> par() {
+            return collection.parallel();
+        }
+
+        @Override
+        public Iterator<T> iterator() {
+            return collection.iterator();
+        }
+
+        @Override
+        public Spliterator<T> spliterator() {
+            // @@@ FIXME!
+            return Arrays.spliterator((T[]) collection.toArray());
+        }
+
+        @Override
+        public void forEach(Sink<? super T> sink) {
+            collection.forEach(sink);
+        }
+
+        @Override
+        public int size() {
+            return collection.size();
+        }
+
+        @Override
+        public String toString() {
+            return collection.toString();
+        }
+    }
+
+    // Return an array of ( String name, ArrayTestData<Integer> )
     @DataProvider(name = "opArrays")
     public static Object[][] makeOpArrays() {
-        return new Object[][]{
-                {"array to zero", to0},
-                {"array to one", to1},
-                {"array to ten", to10},
-                {"array to 100", to100},
-                {"array to 1000", to1000},
-                {"array 100 ones", ones},
-                {"array to 100 twice", twice},
-                {"array reversed", reversed},
-                {"array pseudorandom", pseudoRandom}};
+        return testData;
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/CumulateOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/CumulateOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -27,6 +27,7 @@
 import org.openjdk.tests.java.util.streams.StreamTestDataProvider;
 import org.testng.annotations.Test;
 
+import java.util.concurrent.ForkJoinUtils;
 import java.util.streams.ops.CumulateOp;
 import java.util.streams.ops.FlatMapOp;
 
@@ -47,7 +48,7 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, new CumulateOp<>(rPlus), l -> l);
         assertConsistentOpBehavior(data, new CumulateOp<>(rMin), l -> l);
         assertConsistentOpBehavior(data, new CumulateOp<>(rMax), l -> l);
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/FilterOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/FilterOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -48,7 +48,7 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, new FilterOp<>(pTrue), l -> l);
         assertConsistentOpBehavior(data, new FilterOp<>(pFalse), l -> 0);
         assertConsistentOpBehavior(data, new FilterOp<>(pEven));
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/FlatMapOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/FlatMapOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -64,12 +64,12 @@
         assertCountSum(FlatMapOp.iterator(countTo(10).iterator(), mfNull), 0, 0);
         assertCountSum(FlatMapOp.iterator(countTo(3).iterator(), mfLt), 6, 4);
 
-        assertConsistentOpBehavior(stringsArray, new FlatMapOp<>(flattenChars), null);
-        assertConsistentOpBehavior(new String[] { LONG_STRING }, new FlatMapOp<>(flattenChars), null);
+        assertConsistentOpBehavior(new StreamTestDataProvider.ArrayTestData<String>(stringsArray), new FlatMapOp<>(flattenChars), null);
+        assertConsistentOpBehavior(new StreamTestDataProvider.ArrayTestData<String>(new String[] { LONG_STRING }), new FlatMapOp<>(flattenChars), null);
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, new FlatMapOp<>(mfId), l -> l);
         assertConsistentOpBehavior(data, new FlatMapOp<>(mfNull), l -> 0);
         assertConsistentOpBehavior(data, new FlatMapOp<>(mfLt));
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/GroupByOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/GroupByOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -64,7 +64,7 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, new GroupByOp<>(mId));
         assertConsistentOpBehavior(data, new GroupByOp<>(mZero));
         assertConsistentOpBehavior(data, new GroupByOp<>(mDoubler));
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/MapOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/MapOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -50,7 +50,7 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, new MapOp<>(mId), l -> l);
         assertConsistentOpBehavior(data, new MapOp<>(mZero), l -> l);
         assertConsistentOpBehavior(data, new MapOp<>(mDoubler), l -> l);
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/SortedOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/SortedOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -46,9 +46,9 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         SortedOp<Integer> op = new SortedOp<>(cInteger);
-        assertSorted(seq(data, op).into(new ArrayList<Integer>()).iterator());
+        assertSorted(data.seq(op).into(new ArrayList<Integer>()).iterator());
         assertConsistentOpBehavior(data, op, l->l);
         assertConsistentOpBehavior(data, new SortedOp<>(cInteger.reverse()), l -> l);
     }
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/StreamOpTestCase.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/StreamOpTestCase.java	Tue Aug 28 16:52:28 2012 -0400
@@ -25,6 +25,7 @@
 package org.openjdk.tests.java.util.streams.ops;
 
 import org.openjdk.tests.java.util.LambdaTestHelpers;
+import org.openjdk.tests.java.util.streams.StreamTestDataProvider.TestData;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -51,55 +52,22 @@
 @Test
 public abstract class StreamOpTestCase {
 
-    protected static <T> Stream<T> seq(T[] data) {
-        return Streams.stream(Arrays.iterator(data), data.length);
-    }
-
-    protected static <T> Stream<T> par(T[] data) {
-        return Streams.parallel(Arrays.spliterator(data), data.length);
-    }
-
-    protected static <T, U> Stream<U> seq(T[] data, IntermediateOp<T,U> op) {
-        return ((LinearPipeline) Streams.stream(Arrays.iterator(data), data.length)).pipeline(op);
-    }
-
-    protected static <T, U> Stream<U> par(T[] data, IntermediateOp<T,U> op) {
-        return ((LinearPipeline) Streams.parallel(Arrays.spliterator(data), data.length)).pipeline(op);
-    }
-
-    protected static <T, U> U seq(T[] data, TerminalOp<T,U> op) {
-        return ((LinearPipeline<?, T>) Streams.stream(Arrays.iterator(data), data.length)).pipeline(op);
-    }
-
-    protected static <T, U> U par(T[] data, TerminalOp<T,U> op) {
-        return ((LinearPipeline<?, T>) Streams.parallel(Arrays.spliterator(data), data.length)).pipeline(op);
-    }
-
-    protected static<T> Iterator<T> iterator(T[] data) {
-        return Arrays.iterator(data);
-    }
-
-    protected static <T> void forEach(T[] data, Sink<? super T> sink) {
-        for (T t : data)
-            sink.accept(t);
-    }
-
-    protected static <T, U> void assertConsistentOpBehavior(T[] data,
-                                                     IntermediateOp<T, U> op,
-                                                     Mapper<Integer, Integer> lengthMapper) {
-        int length = (lengthMapper == null) ? 100 : lengthMapper.map(data.length);
+    protected static <T, U> void assertConsistentOpBehavior(TestData<T> data,
+                                                            IntermediateOp<T, U> op,
+                                                            Mapper<Integer, Integer> lengthMapper) {
+        int length = (lengthMapper == null) ? 100 : lengthMapper.map(data.size());
 
         ArraySink<U> refResult = new ArraySink<>(length);
 
         // First pass -- grab an iterator and wrap it
-        Iterator<U> it = op.iterator(iterator(data));
+        Iterator<U> it = op.iterator(data.iterator());
         while (it.hasNext()) {
             refResult.accept(it.next());
         }
 
         // If a length mapper has been specified, make sure it is right
         if (lengthMapper != null) {
-            Assert.assertEquals(refResult.size(), (int)lengthMapper.map(data.length));
+            Assert.assertEquals(refResult.size(), (int)lengthMapper.map(data.size()));
         }
 
         // Second pass -- create a sink and wrap it
@@ -109,10 +77,10 @@
             if (wrapped instanceof StatefulSink) {
                 StatefulSink<T, ?> stateful = (StatefulSink<T, ?>)wrapped;
                 stateful.begin(-1);
-                forEach(data, stateful);
+                data.forEach(stateful);
                 stateful.end();
             } else {
-                forEach(data, wrapped);
+                data.forEach(wrapped);
             }
             assertEquals(refResult, sink2);
         }
@@ -120,14 +88,14 @@
         // Third pass -- wrap with SequentialPipeline.op, and iterate in push mode
         {
             ArraySink<U> sink3 = new ArraySink<>(length);
-            seq(data, op).forEach(sink3);
+            data.seq(op).forEach(sink3);
             assertEquals(refResult, sink3);
         }
 
         // Wrap with SequentialPipeline.op, and iterate in pull mode
         {
             ArraySink<U> sink4 = new ArraySink<>(length);
-            Iterator<U> seqIter = seq(data, op).iterator();
+            Iterator<U> seqIter = data.seq(op).iterator();
             while (seqIter.hasNext()) {
                 sink4.accept(seqIter.next());
             }
@@ -137,7 +105,7 @@
         // Wrap with SequentialPipeline.op, and iterate in mixed mode
         {
             ArraySink<U> sink5 = new ArraySink<>(length);
-            Stream<U> stream = seq(data, op);
+            Stream<U> stream = data.seq(op);
             Iterator<U> iter = stream.iterator();
             if (iter.hasNext()) {
                 sink5.accept(iter.next());
@@ -151,7 +119,7 @@
             if (op.isStateful()) {
                 StatefulOp<T, U, ?> sop = (StatefulOp<T, U, ?>) op;
                 ArraySink<U> sink6a = new ArraySink<>(length);
-                TreeUtils.Node<U> result = sop.computeParallel(new DummyParallelOpHelper<>(data));
+                TreeUtils.Node<U> result = sop.computeParallel(new DummyParallelOpHelper<T>(data));
                 for (U u : result)
                     sink6a.accept(u);
                 assertEquals(refResult, sink6a);
@@ -161,14 +129,14 @@
         // Wrap with ParallelPipeline.op.sequential
         {
             ArraySink<U> sink6 = new ArraySink<>(length);
-            ((LinearPipeline) par(data, op)).sequential().forEach(sink6);
+            data.par(op).sequential().forEach(sink6);
             assertEquals(refResult, sink6);
         }
 
         // Wrap with ParallelPipeline.op.toArray
         {
             ArraySink<U> sink7 = new ArraySink<>(length);
-            Object[] array = par(data, op).toArray();
+            Object[] array = data.par(op).toArray();
             for (Object t : array)
                 sink7.accept((U) t);
             assertEquals(refResult, sink7);
@@ -177,7 +145,7 @@
         // Wrap with ParallelPipeline.op.into
         {
             ArraySink<U> sink8 = new ArraySink<>(length);
-            ArrayList list = (ArrayList) ((LinearPipeline) par(data, op)).sequential().into(new ArrayList());
+            ArrayList list = (ArrayList) data.par(op).sequential().into(new ArrayList());
             for (Object u : list)
                 sink8.accept((U) u);
             assertEquals(refResult, sink8);
@@ -189,48 +157,47 @@
         // Extends testing to test whether computation happens in- or out-of-thread
     }
 
-    protected <T, U> void assertConsistentOpBehavior(T[] data, IntermediateOp<T, U> op) {
+    protected <T, U> void assertConsistentOpBehavior(TestData<T> data, IntermediateOp<T, U> op) {
         assertConsistentOpBehavior(data, op, null);
     }
 
-    protected <T, U> void assertConsistentOpBehavior(T[] data, TerminalOp<T, U> op) {
+    protected <T, U> void assertConsistentOpBehavior(TestData<T> data, TerminalOp<T, U> op) {
         assertConsistentOpBehavior(data, op, (u, v) -> u.equals(v));
     }
 
-
-    protected static <T, U> void assertConsistentOpBehavior(T[] data, ShortCircuitTerminalOp<T, U> op) {
+    protected static <T, U> void assertConsistentOpBehavior(TestData<T> data, ShortCircuitTerminalOp<T, U> op) {
         // First pass -- wrap Iterator
-        U answer1 = op.evaluate(iterator(data));
+        U answer1 = op.evaluate(data.iterator());
 
         // Second pass -- wrap with SequentialPipeline.op
-        Assert.assertEquals(answer1, seq(data, op));
+        Assert.assertEquals(answer1, data.seq(op));
 
         // Fourth pass -- wrap with ParallelPipeline.op
-        Assert.assertEquals(answer1, par(data, op));
+        Assert.assertEquals(answer1, data.par(op));
     }
 
     // @@@ Merge these two into a single method
 
-    protected static <T, U> void assertConsistentOpBehavior(T[] data, TerminalOp<T, U> op, BiPredicate<U,U> equalator) {
+    protected static <T, U> void assertConsistentOpBehavior(TestData<T> data, TerminalOp<T, U> op, BiPredicate<U,U> equalator) {
         // First pass -- create a sink and evaluate, with no size advice
         StatefulSink<T, U> sink = op.sink();
         sink.begin(-1);
-        forEach(data, sink);
+        data.forEach(sink);
         U answer1 = sink.end();
 
         // Second pass -- create a sink and evaluate, with size advice
         StatefulSink<T, U> sink2 = op.sink();
-        sink2.begin(data.length);
-        forEach(data, sink2);
+        sink2.begin(data.size());
+        data.forEach(sink2);
         U answer2 = sink2.end();
         Assert.assertTrue(equalator.test(answer1, answer2));
 
         // Third pass -- wrap with SequentialPipeline.op
-        U answer3 = seq(data, op);
+        U answer3 = data.seq(op);
         Assert.assertTrue(equalator.test(answer1, answer3));
 
         // Fourth pass -- wrap with ParallelPipeline.op
-        U answer4 = par(data, op);
+        U answer4 = data.par(op);
         Assert.assertTrue(equalator.test(answer1, answer4));
     }
 
@@ -304,20 +271,20 @@
     }
 
     private static class DummyParallelOpHelper<T> implements ParallelOp.ParallelOpHelper<T,T> {
-        private final T[] data;
+        private final TestData<T> data;
 
-        public DummyParallelOpHelper(T[] data) {
+        public DummyParallelOpHelper(TestData<T> data) {
             this.data = data;
         }
 
         @Override
         public int suggestDepth() {
-            return ForkJoinUtils.suggestDepth(data.length);
+            return ForkJoinUtils.suggestDepth(data.size());
         }
 
         @Override
         public Spliterator spliterator() {
-            return Arrays.spliterator(data);
+            return data.spliterator();
         }
 
         @Override
@@ -327,7 +294,7 @@
 
         @Override
         public Iterator iterator() {
-            return Arrays.iterator(data);
+            return data.iterator();
         }
 
         @Override
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/ToArrayOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -50,7 +50,7 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         assertConsistentOpBehavior(data, ToArrayOp.<Integer>singleton(), Arrays::equals);
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/streams/ops/UniqOpTest.java	Mon Aug 27 18:50:24 2012 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/streams/ops/UniqOpTest.java	Tue Aug 28 16:52:28 2012 -0400
@@ -47,9 +47,9 @@
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, Integer[] data) {
+    public void testOps(String name, StreamTestDataProvider.TestData<Integer> data) {
         UniqOp<Integer> op = UniqOp.singleton();
-        ArrayList<Integer> result = seq(data, op).into(new ArrayList<Integer>());
+        ArrayList<Integer> result = data.seq(op).into(new ArrayList<Integer>());
         assertUnique(result.iterator());
         assertConsistentOpBehavior(data, op, null);
     }