changeset 6422:9363babb2172

- where possible all intermediate ops tests use stream supplier - hide away IntermediateOp[] usages in another builder.
author psandoz
date Fri, 16 Nov 2012 16:44:59 +0100
parents e9b1e2f1094c
children ba27872c81f8
files test-ng/tests/org/openjdk/tests/java/util/stream/OpTestCase.java test-ng/tests/org/openjdk/tests/java/util/stream/op/ConcatOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/CumulateOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/FilterOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/FlagOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/FlatMapOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/MapOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/SortedOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/TeeOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/UniqOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/op/UnorderedStreamTest.java test-ng/tests/org/openjdk/tests/java/util/stream/primitive/IntFilterOpTest.java
diffstat 12 files changed, 101 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/OpTestCase.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/OpTestCase.java	Fri Nov 16 16:44:59 2012 +0100
@@ -70,13 +70,6 @@
         abstract <T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> void run(TestData<T, S_IN> data, Block<U> b, Function<S_OUT, S_IN> m);
     }
 
-    @SuppressWarnings("unchecked")
-    public <T, U, S_IN extends BaseStream<T>> Node<U> exerciseOps(TestData<T, S_IN> data, IntermediateOp... ops) {
-        return (Node<U>) withData(data).
-                using(ops).
-                exercise();
-    }
-
     public <T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> Node<U> exerciseOps(TestData<T, S_IN> data, Function<S_OUT, S_IN> m) {
         return withData(data).
                 using(m).
@@ -96,40 +89,52 @@
                 exercise();
     }
 
-    public <T, S_IN extends BaseStream<T>> IntermediateOpDataBuilder<T, S_IN> withData(TestData<T, S_IN> data) {
+    public <T, S_IN extends BaseStream<T>> DataStreamBuilder<T, S_IN> withData(TestData<T, S_IN> data) {
         Objects.requireNonNull(data);
-        return new IntermediateOpDataBuilder<>(data);
+        return new DataStreamBuilder<>(data);
     }
 
     @SuppressWarnings("rawtypes")
-    public class IntermediateOpDataBuilder<T, S_IN extends BaseStream<T>> {
+    public class DataStreamBuilder<T, S_IN extends BaseStream<T>> {
         final TestData<T, S_IN> data;
 
-        private IntermediateOpDataBuilder(TestData<T, S_IN> data) {
+        private DataStreamBuilder(TestData<T, S_IN> data) {
             this.data = Objects.requireNonNull(data);
         }
 
-        public <U, S_OUT extends BaseStream<U>> IntermediateOpTestBuilder<T, U, S_IN, S_OUT> using(IntermediateOp... ops) {
+        public DataIntemediateOpBuilder<T, S_IN> ops() {
+            return new DataIntemediateOpBuilder<>(data);
+        }
+
+        public <U, S_OUT extends BaseStream<U>> ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> using(Function<S_OUT, S_IN> m) {
+            return new ExcerciseDataStreamBuilder<>(data, m);
+        }
+    }
+
+    @SuppressWarnings("rawtypes")
+    public class DataIntemediateOpBuilder<T, S_IN extends BaseStream<T>> {
+        final TestData<T, S_IN> data;
+
+        private DataIntemediateOpBuilder(TestData<T, S_IN> data) {
+            this.data = Objects.requireNonNull(data);
+        }
+
+        public <U, S_OUT extends BaseStream<U>> ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> using(IntermediateOp... ops) {
             return usingOpsFactory(() -> ops);
         }
 
-        public <U, S_OUT extends BaseStream<U>> IntermediateOpTestBuilder<T, U, S_IN, S_OUT> usingOpFactory(Supplier<IntermediateOp> fop) {
+        public <U, S_OUT extends BaseStream<U>> ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> usingOpFactory(Supplier<IntermediateOp> fop) {
             return usingOpsFactory(() -> new IntermediateOp[]{fop.get()});
         }
 
         @SuppressWarnings("unchecked")
-        public <U, S_OUT extends BaseStream<U>> IntermediateOpTestBuilder<T, U, S_IN, S_OUT> usingOpsFactory(Supplier<IntermediateOp[]> fops) {
-            return using((S_IN s) -> (S_OUT) chain((AbstractPipeline<?, T>) s, fops.get()));
+        public <U, S_OUT extends BaseStream<U>> ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> usingOpsFactory(Supplier<IntermediateOp[]> fops) {
+            return new ExcerciseDataStreamBuilder<>(data, (S_IN s) -> (S_OUT) chain((AbstractPipeline<?, T>) s, fops.get()));
         }
-
-        public <U, S_OUT extends BaseStream<U>> IntermediateOpTestBuilder<T, U, S_IN, S_OUT> using(Function<S_OUT, S_IN> m) {
-            return new IntermediateOpTestBuilder<>(data, m);
-        }
-
     }
 
     @SuppressWarnings("rawtypes")
-    public class IntermediateOpTestBuilder<T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> {
+    public class ExcerciseDataStreamBuilder<T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> {
         final TestData<T, S_IN> data;
 
         final Function<S_OUT, S_IN> m;
@@ -150,7 +155,7 @@
 
         BiPredicate<Iterable<U>, Iterable<U>> parallelEqualator = Objects::equals;
 
-        private IntermediateOpTestBuilder(TestData<T, S_IN> data, Function<S_OUT, S_IN> m) {
+        private ExcerciseDataStreamBuilder(TestData<T, S_IN> data, Function<S_OUT, S_IN> m) {
             this.data = data;
 
             this.m = Objects.requireNonNull(m);
@@ -169,7 +174,7 @@
         //
 
         @SuppressWarnings("unchecked")
-        public <I extends Iterable<U> & Sized> IntermediateOpTestBuilder<T, U, S_IN, S_OUT> expectedResult(I expectedResult) {
+        public <I extends Iterable<U> & Sized> ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> expectedResult(I expectedResult) {
             NodeBuilder<U> resultBuilder = shape.makeNodeBuilder(expectedResult.size());
             resultBuilder.begin(expectedResult.size());
             expectedResult.forEach(resultBuilder);
@@ -178,22 +183,22 @@
             return this;
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> before(Block<TestData<T, S_IN>> before) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> before(Block<TestData<T, S_IN>> before) {
             this.before = Objects.requireNonNull(before);
             return this;
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> after(Block<TestData<T, S_IN>> after) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> after(Block<TestData<T, S_IN>> after) {
             this.after = Objects.requireNonNull(after);
             return this;
         }
 
         @SuppressWarnings("unchecked")
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> without(IntermediateOpTestScenario... tests) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> without(IntermediateOpTestScenario... tests) {
             return without(Arrays.asList(tests));
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> without(Collection<? extends IntermediateOpTestScenario> tests) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> without(Collection<? extends IntermediateOpTestScenario> tests) {
             for (IntermediateOpTestScenario ts : tests) {
                 if (ts.getShape().getStreamType() == shape.getStreamType()) {
                     testSet.remove(ts);
@@ -208,11 +213,11 @@
         }
 
         @SuppressWarnings("unchecked")
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> with(IntermediateOpTestScenario... tests) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> with(IntermediateOpTestScenario... tests) {
             return with(Arrays.asList(tests));
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> with(Collection<? extends IntermediateOpTestScenario> tests) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> with(Collection<? extends IntermediateOpTestScenario> tests) {
             testSet = new HashSet<>();
 
             for (IntermediateOpTestScenario ts : tests) {
@@ -228,12 +233,12 @@
             return this;
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> sequentialEqualator(BiPredicate<Iterable<U>, Iterable<U>> equalator) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> sequentialEqualator(BiPredicate<Iterable<U>, Iterable<U>> equalator) {
             this.sequentialEqualator = equalator;
             return this;
         }
 
-        public IntermediateOpTestBuilder<T, U, S_IN, S_OUT> parallelEqualator(BiPredicate<Iterable<U>, Iterable<U>> equalator) {
+        public ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> parallelEqualator(BiPredicate<Iterable<U>, Iterable<U>> equalator) {
             this.parallelEqualator = equalator;
             return this;
         }
@@ -246,7 +251,7 @@
     }
 
     @SuppressWarnings({"rawtypes", "unchecked"})
-    protected static <T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> Node<U> exerciseOps(IntermediateOpTestBuilder<T, U, S_IN, S_OUT> b) {
+    protected static <T, U, S_IN extends BaseStream<T>, S_OUT extends BaseStream<U>> Node<U> exerciseOps(ExcerciseDataStreamBuilder<T, U, S_IN, S_OUT> b) {
         Node<U> refResult;
         if (b.refResult != null) {
             refResult = b.refResult;
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/ConcatOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/ConcatOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -107,14 +107,14 @@
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOpsSequential(String name, StreamTestData<Integer> data) {
         withData(data).
-                usingOpFactory(() -> new ConcatOp<>(data.stream())).
+                using(s -> s.concat(data.stream())).
                 exercise();
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOpsParallel(String name, StreamTestData<Integer> data) {
         withData(data).
-                usingOpFactory(() -> new ConcatOp<>(data.parallel())).
+                using(s -> s.concat(data.parallel())).
                 exercise();
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/CumulateOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/CumulateOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -57,20 +57,20 @@
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOps(String name, StreamTestData<Integer> data) {
-        Node<Integer> result = exerciseOps(data, new CumulateOp<>(rPlus));
+        Node<Integer> result = exerciseOps(data, s -> s.cumulate(rPlus));
         assertEquals(result.size(), data.size());
 
-        result = exerciseOps(data, new CumulateOp<>(rMin));
+        result = exerciseOps(data, s -> s.cumulate(rMin));
         assertEquals(result.size(), data.size());
 
-        result = exerciseOps(data, new CumulateOp<>(rMax));
+        result = exerciseOps(data, s -> s.cumulate(rMax));
         assertEquals(result.size(), data.size());
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testWithFilter(String name, StreamTestData<Integer> data) {
-        exerciseOps(data, new FilterOp<>(pEven), new CumulateOp<>(rPlus));
-        exerciseOps(data, new FilterOp<>(pEven), new MapOp<>(mDoubler), new CumulateOp<>(rPlus));
-        exerciseOps(data, new FilterOp<Integer>(x -> x == -1), new CumulateOp<>(rPlus));
+        exerciseOps(data, s -> s.filter(pEven).cumulate(rPlus));
+        exerciseOps(data, s -> s.filter(pEven).map(mDoubler).cumulate(rPlus));
+        exerciseOps(data, s -> s.filter(x -> false).cumulate(rPlus));
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/FilterOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/FilterOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -69,19 +69,19 @@
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOps(String name, StreamTestData<Integer> data) {
-        Node<Integer> result = exerciseOps(data, new FilterOp<>(pTrue));
+        Node<Integer> result = exerciseOps(data, s -> s.filter(pTrue));
         assertEquals(result.size(), data.size());
 
-        result = exerciseOps(data, new FilterOp<>(pFalse));
+        result = exerciseOps(data, s -> s.filter(pFalse));
         assertEquals(result.size(), 0);
 
-        exerciseOps(data, new FilterOp<>(pEven));
-        exerciseOps(data, new FilterOp<>(pOdd));
+        exerciseOps(data, s -> s.filter(pEven));
+        exerciseOps(data, s -> s.filter(pOdd));
 
-        result = exerciseOps(data, new FilterOp<>(pOdd.and(pEven)));
+        result = exerciseOps(data, s -> s.filter(pOdd.and(pEven)));
         assertEquals(result.size(), 0);
 
-        result = exerciseOps(data, new FilterOp<>(pOdd.or(pEven)));
+        result = exerciseOps(data, s -> s.filter(pOdd.or(pEven)));
         assertEquals(result.size(), data.size());
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/FlagOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/FlagOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -55,7 +55,8 @@
         ops[1].set(ops[0], ops[2]);
         ops[2].set(ops[1], null);
 
-        exerciseOps(data, ops);
+        withData(data).ops().
+                using(ops).exercise();
     }
 
     static class TestFlagPassThroughOp<T> extends FlagDeclaringOp<T> {
@@ -127,7 +128,7 @@
         @SuppressWarnings("rawtypes")
         FlagDeclaringOp[] opsArray = ops.toArray(new FlagDeclaringOp[ops.size()]);
 
-        withData(data).
+        withData(data).ops().
                 using(opsArray).
                 without(StreamIntermediateOpTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
                 exercise();
@@ -164,7 +165,7 @@
         FlagDeclaringOp[] opsArray = ops.toArray(new FlagDeclaringOp[ops.size()]);
 
 
-        withData(data).
+        withData(data).ops().
                 using(opsArray).
                 without(StreamIntermediateOpTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
                 exercise();
@@ -202,7 +203,7 @@
         @SuppressWarnings("rawtypes")
         IntermediateOp[] opsArray = ops.toArray(new IntermediateOp[ops.size()]);
 
-        withData(data).
+        withData(data).ops().
                 using(opsArray).
                 without(StreamIntermediateOpTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
                 exercise();
@@ -241,7 +242,7 @@
         @SuppressWarnings("rawtypes")
         IntermediateOp[] opsArray = ops.toArray(new IntermediateOp[ops.size()]);
 
-        withData(data).
+        withData(data).ops().
                 using(opsArray).
                 without(StreamIntermediateOpTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
                 exercise();
@@ -268,7 +269,8 @@
         @SuppressWarnings("rawtypes")
         IntermediateOp[] opsArray = ops.toArray(new IntermediateOp[ops.size()]);
 
-        exerciseOps(data, opsArray);
+        withData(data).ops().
+                using(opsArray).exercise();
     }
 
     static class ParSerTestFlagExpectedOp<T> extends FlagDeclaringOp<T> {
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/FlatMapOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/FlatMapOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -70,22 +70,22 @@
         assertCountSum(countTo(10).stream().flatMap(mfNull), 0, 0);
         assertCountSum(countTo(3).stream().flatMap(mfLt), 6, 4);
 
-        exerciseOps(new StreamTestData.ArrayData<>("stringsArray", stringsArray), new FlatMapOp<>(flattenChars));
-        exerciseOps(new StreamTestData.ArrayData<>("LONG_STRING", new String[]{LONG_STRING}), new FlatMapOp<>(flattenChars));
+        exerciseOps(new StreamTestData.ArrayData<>("stringsArray", stringsArray), s -> s.flatMap(flattenChars));
+        exerciseOps(new StreamTestData.ArrayData<>("LONG_STRING", new String[]{LONG_STRING}), s -> s.flatMap(flattenChars));
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOps(String name, StreamTestData<Integer> data) {
-        Node<Integer> result = exerciseOps(data, new FlatMapOp<>(mfId));
+        Node<Integer> result = exerciseOps(data, s -> s.flatMap(mfId));
         assertEquals(data.size(), result.size());
 
-        result = exerciseOps(data, new FlatMapOp<>(mfNull));
+        result = exerciseOps(data, s -> s.flatMap(mfNull));
         assertEquals(0, result.size());
 
-        result = exerciseOps(data, new FlatMapOp<>(mfId));
+        result = exerciseOps(data, s -> s.flatMap(mfId));
         assertEquals(result.size(), data.size());
 
-        exerciseOps(data, new FlatMapOp<>(mfLt));
-        exerciseOps(data, new FlatMapOp<>(mfIntToBits));
+        exerciseOps(data, s -> s.flatMap(mfLt));
+        exerciseOps(data, s -> s.flatMap(mfIntToBits));
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/MapOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/MapOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -60,27 +60,26 @@
         assertCountSum(countTo(10).stream().map(mDoubler), 10, 110);
         assertCountSum(countTo(10).stream().map(mDoubler).map(mDoubler), 10, 220);
 
-
         exerciseOps(countTo(0), s -> s.map(e -> e), countTo(0));
         exerciseOps(countTo(1000), s -> s.map(e -> e), countTo(1000));
-        exerciseOps(countTo(1000), s -> s.map(e -> (1000+e)), range(1001, 2000));
+        exerciseOps(countTo(1000), s -> s.map(e -> (Integer) (1000+e)), range(1001, 2000));
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testOps(String name, StreamTestData<Integer> data) {
-        Node<Integer> result = exerciseOps(data, new MapOp<>(mId));
+        Node<Integer> result = exerciseOps(data, s -> s.map(mId));
         assertEquals(data.size(), result.size());
 
-        result = exerciseOps(data, new MapOp<>(mZero));
+        result = exerciseOps(data, s -> s.map(mZero));
         assertEquals(data.size(), result.size());
 
-        result = exerciseOps(data, new MapOp<>(mDoubler));
+        result = exerciseOps(data, s -> s.map(mDoubler));
         assertEquals(data.size(), result.size());
 
-        result = exerciseOps(data, new MapOp<>(mId.compose(mDoubler)));
+        result = exerciseOps(data, s -> s.map(mId.compose(mDoubler)));
         assertEquals(data.size(), result.size());
 
-        result = exerciseOps(data, new MapOp<>(mDoubler.compose(mDoubler)));
+        result = exerciseOps(data, s -> s.map(mDoubler.compose(mDoubler)));
         assertEquals(data.size(), result.size());
     }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/SortedOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/SortedOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -34,6 +34,7 @@
 import java.util.Comparators;
 import java.util.List;
 import java.util.stream.ParallelPipelineHelper;
+import java.util.stream.Stream;
 import java.util.stream.StreamOpFlags;
 import java.util.stream.op.CollectorOps;
 import java.util.stream.op.Node;
@@ -109,12 +110,12 @@
     public void testOps(String name, StreamTestData<Integer> data) {
         SortedOp<Integer> op = new SortedOp<>(cInteger);
 
-        Node<Integer> result = exerciseOps(data, op);
+        Node<Integer> result = exerciseOps(data, s -> s.sorted(cInteger));
         assertSorted(result.iterator());
         // @@@ Can make stronger assertions about content equality
         Assert.assertEquals(result.size(), data.size());
 
-        result = exerciseOps(data, new SortedOp<>(cInteger.reverse()));
+        result = exerciseOps(data, s -> s.sorted(cInteger.reverse()));
         Assert.assertEquals(result.size(), data.size());
     }
 
@@ -123,7 +124,10 @@
         SortedOp<Integer> op = new SortedOp<>(cInteger);
 
         // For parallel cases ensure the 
-        Node<Integer> result = exerciseOps(data, op, op, new TestParallelSizedOp<>());
+        Node<Integer> result = withData(data).ops().
+                <Integer, Stream<Integer>>using(op, op, new TestParallelSizedOp<>()).
+                exercise();
+
         assertSorted(result.iterator());
         Assert.assertEquals(result.size(), data.size());
     }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/TeeOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/TeeOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -103,7 +103,7 @@
         final RecordingBlock b = new RecordingBlock();
 
         withData(data).
-                using(new TeeOp<>(b)).
+                using(s -> s.tee(b)).
                 before(b::before).
                 after(b::after).
                 exercise();
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/UniqOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/UniqOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -82,20 +82,23 @@
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testUniqUniq(String name, StreamTestData<Integer> data) {
-        exerciseOps(data,
-                    UniqOp.singleton(), UniqOp.singleton(), new TestParallelSizedOp<>());
+        withData(data).ops().
+                using(UniqOp.singleton(), UniqOp.singleton(), new TestParallelSizedOp<>()).
+                exercise();
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testUniqSort(String name, StreamTestData<Integer> data) {
-        exerciseOps(data,
-                    UniqOp.singleton(), new SortedOp<>(), new TestParallelSizedOp<>());
+        withData(data).ops().
+                using(UniqOp.singleton(), new SortedOp<>(), new TestParallelSizedOp<>()).
+                exercise();
     }
 
     @Test(dataProvider = "opArrays", dataProviderClass = StreamTestDataProvider.class)
     public void testSortUniq(String name, StreamTestData<Integer> data) {
-        exerciseOps(data,
-                    new SortedOp<>(), UniqOp.singleton(), new TestParallelSizedOp<>());
+        withData(data).ops().
+                using(new SortedOp<>(), UniqOp.singleton(), new TestParallelSizedOp<>()).
+                exercise();
     }
 
     private static class TestParallelSizedOp<T> extends CollectorOps.Parallel<T> {
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/op/UnorderedStreamTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/op/UnorderedStreamTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -24,6 +24,8 @@
  */
 package org.openjdk.tests.java.util.stream.op;
 
+import org.openjdk.tests.java.util.stream.OpTestCase;
+import org.openjdk.tests.java.util.stream.StreamTestData;
 import org.testng.annotations.Test;
 
 import java.util.Arrays;
@@ -45,13 +47,12 @@
         s = s.unordered();
 
         @SuppressWarnings("unchecked")
-        Stream<Integer> st = new ReferencePipeline<Integer, Integer>(
-                (AbstractPipeline<Integer, Integer>) s,
-                new TestFlagExpectedOp<>(0,
-                                         EnumSet.noneOf(StreamOpFlags.class),
-                                         EnumSet.noneOf(StreamOpFlags.class),
-                                         EnumSet.of(StreamOpFlags.ORDERED)));
+        Stream<Integer> st = (Stream<Integer>) OpTestCase.chain((AbstractPipeline<Integer, Integer>) s,
+                         new TestFlagExpectedOp<Integer>(0,
+                                                  EnumSet.noneOf(StreamOpFlags.class),
+                                                  EnumSet.noneOf(StreamOpFlags.class),
+                                                  EnumSet.of(StreamOpFlags.ORDERED)));
+
         st.toArray();
     }
-
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/primitive/IntFilterOpTest.java	Fri Nov 16 11:26:04 2012 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/primitive/IntFilterOpTest.java	Fri Nov 16 16:44:59 2012 +0100
@@ -35,13 +35,13 @@
 
     @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
     public void testOps(String name, IntStreamTestData data) {
-        Node<Integer> result = exerciseOps(data, new IntFilterOp(i -> true));
+        Node<Integer> result = exerciseOps(data, s -> s.filter(i -> true));
         assertEquals(result.size(), data.size());
 
-        result = exerciseOps(data, new IntFilterOp(i -> false));
+        result = exerciseOps(data, s -> s.filter(i -> false));
         assertEquals(result.size(), 0);
 
-        exerciseOps(data, new IntFilterOp(i -> 0 == i % 2));
-        exerciseOps(data, new IntFilterOp(i -> 1 == i % 2));
+        exerciseOps(data, s -> s.filter(i -> 0 == i % 2));
+        exerciseOps(data, s -> s.filter(i -> 1 == i % 2));
     }
 }