8174171: Move spliterator testing of BitSet into big memory tests BitSetStreamTest
authoramlu
Mon, 24 Apr 2017 13:43:34 +0800
changeset 44789 73fd39e0702e
parent 44788 4528ad632cc0
child 44790 68300357fd81
child 44838 a5a339bfd44e
child 44839 3f4ba193e06a
child 45004 ea3137042a61
child 45014 735b27c929c3
8174171: Move spliterator testing of BitSet into big memory tests BitSetStreamTest Reviewed-by: mli, psandoz
jdk/test/ProblemList.txt
jdk/test/TEST.ROOT
jdk/test/TEST.groups
jdk/test/java/util/BitSet/BitSetStreamTest.java
jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorOfIntDataBuilder.java
--- a/jdk/test/ProblemList.txt	Sun Apr 23 21:39:48 2017 +0200
+++ b/jdk/test/ProblemList.txt	Mon Apr 24 13:43:34 2017 +0800
@@ -280,8 +280,6 @@
 
 # jdk_util
 
-java/util/BitSet/BitSetStreamTest.java                          8079538 generic-all
-
 ############################################################################
 
 # jdk_instrument
--- a/jdk/test/TEST.ROOT	Sun Apr 23 21:39:48 2017 +0200
+++ b/jdk/test/TEST.ROOT	Mon Apr 24 13:43:34 2017 +0800
@@ -18,7 +18,7 @@
 othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation java/lang/ProcessHandle
 
 # Tests that cannot run concurrently
-exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi com/sun/corba/cachedSocket
+exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream java/util/BitSet/stream javax/rmi com/sun/corba/cachedSocket
 
 # Group definitions
 groups=TEST.groups [closed/TEST.groups]
--- a/jdk/test/TEST.groups	Sun Apr 23 21:39:48 2017 +0200
+++ b/jdk/test/TEST.groups	Mon Apr 24 13:43:34 2017 +0800
@@ -714,7 +714,7 @@
   java/security/BasicPermission/Wildcard.java \
   java/util/Arrays/ParallelPrefix.java  \
   java/util/Arrays/SetAllTest.java  \
-  java/util/BitSet/BitSetStreamTest.java  \
+  java/util/BitSet/stream/BitSetStreamTest.java  \
   java/util/Collection/CollectionDefaults.java  \
   java/util/Collections/CheckedIdentityMap.java  \
   java/util/Collections/CheckedMapBash.java  \
--- a/jdk/test/java/util/BitSet/BitSetStreamTest.java	Sun Apr 23 21:39:48 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import java.lang.Integer;
-import java.lang.Object;
-import java.lang.System;
-import java.util.BitSet;
-import java.util.OptionalInt;
-import java.util.PrimitiveIterator;
-import java.util.Random;
-import java.util.function.IntSupplier;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-/**
- * @test
- * @summary test BitSet stream
- * @bug 8012645 8076442
- * @run testng BitSetStreamTest
- */
-public class BitSetStreamTest {
-    static class Fibs implements IntSupplier {
-        private int n1 = 0;
-        private int n2 = 1;
-
-        static int fibs(int n) {
-            Fibs f = new Fibs();
-            while (n-- > 0) f.getAsInt();
-            return f.getAsInt();
-        }
-
-        public int getAsInt() { int s = n1; n1 = n2; n2 = s + n1; return s; }
-    }
-
-    @Test
-    public void testFibs() {
-        Fibs f = new Fibs();
-        assertEquals(0, f.getAsInt());
-        assertEquals(1, f.getAsInt());
-        assertEquals(1, f.getAsInt());
-        assertEquals(2, f.getAsInt());
-        assertEquals(3, f.getAsInt());
-        assertEquals(5, f.getAsInt());
-        assertEquals(8, f.getAsInt());
-        assertEquals(13, f.getAsInt());
-        assertEquals(987, Fibs.fibs(16));
-    }
-
-
-    @DataProvider(name = "cases")
-    public static Object[][] produceCases() {
-        return new Object[][] {
-                { "none", IntStream.empty() },
-                { "index 0", IntStream.of(0) },
-                { "index 255", IntStream.of(255) },
-                { "index 0 and 255", IntStream.of(0, 255) },
-                { "index Integer.MAX_VALUE", IntStream.of(Integer.MAX_VALUE) },
-                { "index Integer.MAX_VALUE - 1", IntStream.of(Integer.MAX_VALUE - 1) },
-                { "index 0 and Integer.MAX_VALUE", IntStream.of(0, Integer.MAX_VALUE) },
-                { "every bit", IntStream.range(0, 255) },
-                { "step 2", IntStream.range(0, 255).map(f -> f * 2) },
-                { "step 3", IntStream.range(0, 255).map(f -> f * 3) },
-                { "step 5", IntStream.range(0, 255).map(f -> f * 5) },
-                { "step 7", IntStream.range(0, 255).map(f -> f * 7) },
-                { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000) },
-                { "25 fibs", IntStream.generate(new Fibs()).limit(25) }
-        };
-    }
-
-    @Test(dataProvider = "cases")
-    public void testBitsetStream(String name, IntStream data) {
-        BitSet bs = data.collect(BitSet::new, BitSet::set, BitSet::or);
-
-        assertEquals(bs.cardinality(), bs.stream().count());
-
-        int[] indexHolder = new int[] { -1 };
-        bs.stream().forEach(i -> {
-            int ei = indexHolder[0];
-            indexHolder[0] = bs.nextSetBit(ei + 1);
-            assertEquals(i, indexHolder[0]);
-        });
-
-        PrimitiveIterator.OfInt it = bs.stream().iterator();
-        for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
-            assertTrue(it.hasNext());
-            assertEquals(it.nextInt(), i);
-            if (i == Integer.MAX_VALUE)
-                break; // or (i + 1) would overflow
-        }
-        assertFalse(it.hasNext());
-    }
-
-    @Test
-    public void testRandomStream() {
-        final int size = 1024 * 1024;
-        final int[] seeds = {
-                2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
-                43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
-        final byte[] bytes = new byte[size];
-        for (int seed : seeds) {
-            final Random random = new Random(seed);
-            random.nextBytes(bytes);
-
-            BitSet bitSet = BitSet.valueOf(bytes);
-            testBitSetContents(bitSet, bitSet.stream().toArray());
-            testBitSetContents(bitSet, bitSet.stream().parallel().toArray());
-        }
-    }
-
-    void testBitSetContents(BitSet bitSet, int[] array) {
-        int cardinality = bitSet.cardinality();
-        assertEquals(array.length, cardinality);
-        int nextSetBit = -1;
-        for (int i = 0; i < cardinality; i++) {
-            nextSetBit = bitSet.nextSetBit(nextSetBit + 1);
-            assertEquals(array[i], nextSetBit);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java	Mon Apr 24 13:43:34 2017 +0800
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Collection;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Random;
+import java.util.Spliterator;
+import java.util.SpliteratorOfIntDataBuilder;
+import java.util.SpliteratorTestHelper;
+import java.util.function.IntConsumer;
+import java.util.function.IntSupplier;
+import java.util.function.Supplier;
+import java.util.stream.IntStream;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.util.stream.Collectors.toList;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @test
+ * @summary test BitSet stream
+ * @bug 8012645 8076442
+ * @requires os.maxMemory >= 2g
+ * @library ../../stream/bootlib
+ * @build java.base/java.util.SpliteratorTestHelper
+ *        java.base/java.util.SpliteratorOfIntDataBuilder
+ * @run testng/othervm -Xms512m -Xmx1024m BitSetStreamTest
+ */
+public class BitSetStreamTest extends SpliteratorTestHelper {
+    static class Fibs implements IntSupplier {
+        private int n1 = 0;
+        private int n2 = 1;
+
+        static int fibs(int n) {
+            Fibs f = new Fibs();
+            while (n-- > 0) f.getAsInt();
+            return f.getAsInt();
+        }
+
+        public int getAsInt() { int s = n1; n1 = n2; n2 = s + n1; return s; }
+    }
+
+    @Test
+    public void testFibs() {
+        Fibs f = new Fibs();
+        assertEquals(0, f.getAsInt());
+        assertEquals(1, f.getAsInt());
+        assertEquals(1, f.getAsInt());
+        assertEquals(2, f.getAsInt());
+        assertEquals(3, f.getAsInt());
+        assertEquals(5, f.getAsInt());
+        assertEquals(8, f.getAsInt());
+        assertEquals(13, f.getAsInt());
+        assertEquals(987, Fibs.fibs(16));
+    }
+
+
+    @DataProvider(name = "cases")
+    public static Object[][] produceCases() {
+        return new Object[][] {
+                { "none", IntStream.empty() },
+                { "index 0", IntStream.of(0) },
+                { "index 255", IntStream.of(255) },
+                { "index 0 and 255", IntStream.of(0, 255) },
+                { "index Integer.MAX_VALUE", IntStream.of(Integer.MAX_VALUE) },
+                { "index Integer.MAX_VALUE - 1", IntStream.of(Integer.MAX_VALUE - 1) },
+                { "index 0 and Integer.MAX_VALUE", IntStream.of(0, Integer.MAX_VALUE) },
+                { "every bit", IntStream.range(0, 255) },
+                { "step 2", IntStream.range(0, 255).map(f -> f * 2) },
+                { "step 3", IntStream.range(0, 255).map(f -> f * 3) },
+                { "step 5", IntStream.range(0, 255).map(f -> f * 5) },
+                { "step 7", IntStream.range(0, 255).map(f -> f * 7) },
+                { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000) },
+                { "25 fibs", IntStream.generate(new Fibs()).limit(25) }
+        };
+    }
+
+    @Test(dataProvider = "cases")
+    public void testBitsetStream(String name, IntStream data) {
+        BitSet bs = data.collect(BitSet::new, BitSet::set, BitSet::or);
+
+        assertEquals(bs.cardinality(), bs.stream().count());
+
+        int[] indexHolder = new int[] { -1 };
+        bs.stream().forEach(i -> {
+            int ei = indexHolder[0];
+            indexHolder[0] = bs.nextSetBit(ei + 1);
+            assertEquals(i, indexHolder[0]);
+        });
+
+        PrimitiveIterator.OfInt it = bs.stream().iterator();
+        for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
+            assertTrue(it.hasNext());
+            assertEquals(it.nextInt(), i);
+            if (i == Integer.MAX_VALUE)
+                break; // or (i + 1) would overflow
+        }
+        assertFalse(it.hasNext());
+    }
+
+    static Object[][] spliteratorOfIntDataProvider;
+
+    @DataProvider(name = "BitSet.stream.spliterator")
+    public static Object[][] spliteratorOfIntDataProvider() {
+        if (spliteratorOfIntDataProvider != null) {
+            return spliteratorOfIntDataProvider;
+        }
+
+        List<Object[]> data = new ArrayList<>();
+
+        Object[][] bitStreamTestcases = new Object[][] {
+                { "none", IntStream.empty().toArray() },
+                { "index 0", IntStream.of(0).toArray() },
+                { "index 255", IntStream.of(255).toArray() },
+                { "index 0 and 255", IntStream.of(0, 255).toArray() },
+                { "index Integer.MAX_VALUE", IntStream.of(Integer.MAX_VALUE).toArray() },
+                { "index Integer.MAX_VALUE - 1", IntStream.of(Integer.MAX_VALUE - 1).toArray() },
+                { "index 0 and Integer.MAX_VALUE", IntStream.of(0, Integer.MAX_VALUE).toArray() },
+                { "every bit", IntStream.range(0, 255).toArray() },
+                { "step 2", IntStream.range(0, 255).map(f -> f * 2).toArray() },
+                { "step 3", IntStream.range(0, 255).map(f -> f * 3).toArray() },
+                { "step 5", IntStream.range(0, 255).map(f -> f * 5).toArray() },
+                { "step 7", IntStream.range(0, 255).map(f -> f * 7).toArray() },
+                { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000).toArray() },
+        };
+        for (Object[] tc : bitStreamTestcases) {
+            String description = (String)tc[0];
+            int[] exp = (int[])tc[1];
+            SpliteratorOfIntDataBuilder db = new SpliteratorOfIntDataBuilder(
+                    data, IntStream.of(exp).boxed().collect(toList()));
+
+            db.add("BitSet.stream.spliterator() {" + description + "}", () ->
+                IntStream.of(exp).collect(BitSet::new, BitSet::set, BitSet::or).
+                        stream().spliterator()
+            );
+        }
+        return spliteratorOfIntDataProvider = data.toArray(new Object[0][]);
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
+        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntForEach(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testForEach(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntTryAdvance(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testTryAdvance(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntMixedTryAdvanceForEach(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testMixedTryAdvanceForEach(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntMixedTraverseAndSplit(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testMixedTraverseAndSplit(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntSplitAfterFullTraversal(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testSplitAfterFullTraversal(s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntSplitOnce(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testSplitOnce(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntSplitSixDeep(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testSplitSixDeep(exp, s, intBoxingConsumer());
+    }
+
+    @Test(dataProvider = "BitSet.stream.spliterator")
+    public void testIntSplitUntilNull(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        testSplitUntilNull(exp, s, intBoxingConsumer());
+    }
+
+    @Test
+    public void testRandomStream() {
+        final int size = 1024 * 1024;
+        final int[] seeds = {
+                2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
+                43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
+        final byte[] bytes = new byte[size];
+        for (int seed : seeds) {
+            final Random random = new Random(seed);
+            random.nextBytes(bytes);
+
+            BitSet bitSet = BitSet.valueOf(bytes);
+            testBitSetContents(bitSet, bitSet.stream().toArray());
+            testBitSetContents(bitSet, bitSet.stream().parallel().toArray());
+        }
+    }
+
+    void testBitSetContents(BitSet bitSet, int[] array) {
+        int cardinality = bitSet.cardinality();
+        assertEquals(array.length, cardinality);
+        int nextSetBit = -1;
+        for (int i = 0; i < cardinality; i++) {
+            nextSetBit = bitSet.nextSetBit(nextSetBit + 1);
+            assertEquals(array[i], nextSetBit);
+        }
+    }
+}
--- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java	Sun Apr 23 21:39:48 2017 +0200
+++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java	Mon Apr 24 13:43:34 2017 +0800
@@ -25,7 +25,8 @@
  * @test
  * @summary Spliterator traversing and splitting tests
  * @library ../stream/bootlib
- * @build java.base/java.util.SpliteratorTestHelper
+ * @build java.base/java.util.SpliteratorOfIntDataBuilder
+ *        java.base/java.util.SpliteratorTestHelper
  * @run testng SpliteratorTraversingAndSplittingTest
  * @bug 8020016 8071477 8072784 8169838
  */
@@ -40,7 +41,6 @@
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.BitSet;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -59,6 +59,7 @@
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.Spliterator;
+import java.util.SpliteratorOfIntDataBuilder;
 import java.util.SpliteratorTestHelper;
 import java.util.Spliterators;
 import java.util.Stack;
@@ -84,9 +85,6 @@
 import java.util.function.LongConsumer;
 import java.util.function.Supplier;
 import java.util.function.UnaryOperator;
-import java.util.stream.IntStream;
-
-import static java.util.stream.Collectors.toList;
 
 public class SpliteratorTraversingAndSplittingTest extends SpliteratorTestHelper {
 
@@ -713,34 +711,6 @@
     }
 
     //
-
-    private static class SpliteratorOfIntDataBuilder {
-        List<Object[]> data;
-
-        List<Integer> exp;
-
-        SpliteratorOfIntDataBuilder(List<Object[]> data, List<Integer> exp) {
-            this.data = data;
-            this.exp = exp;
-        }
-
-        void add(String description, List<Integer> expected, Supplier<Spliterator.OfInt> s) {
-            description = joiner(description).toString();
-            data.add(new Object[]{description, expected, s});
-        }
-
-        void add(String description, Supplier<Spliterator.OfInt> s) {
-            add(description, exp, s);
-        }
-
-        StringBuilder joiner(String description) {
-            return new StringBuilder(description).
-                    append(" {").
-                    append("size=").append(exp.size()).
-                    append("}");
-        }
-    }
-
     private static class SpliteratorOfIntCharDataBuilder {
         List<Object[]> data;
 
@@ -884,30 +854,6 @@
             cdb.add("CharBuffer.wrap(\"%s\".toCharArray())", s -> CharBuffer.wrap(s.toCharArray()));
         }
 
-
-        Object[][] bitStreamTestcases = new Object[][] {
-                { "none", IntStream.empty().toArray() },
-                { "index 0", IntStream.of(0).toArray() },
-                { "index 255", IntStream.of(255).toArray() },
-                { "index 0 and 255", IntStream.of(0, 255).toArray() },
-                { "every bit", IntStream.range(0, 255).toArray() },
-                { "step 2", IntStream.range(0, 255).map(f -> f * 2).toArray() },
-                { "step 3", IntStream.range(0, 255).map(f -> f * 3).toArray() },
-                { "step 5", IntStream.range(0, 255).map(f -> f * 5).toArray() },
-                { "step 7", IntStream.range(0, 255).map(f -> f * 7).toArray() },
-                { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000).toArray() },
-        };
-        for (Object[] tc : bitStreamTestcases) {
-            String description = (String)tc[0];
-            int[] exp = (int[])tc[1];
-            SpliteratorOfIntDataBuilder db = new SpliteratorOfIntDataBuilder(
-                    data, IntStream.of(exp).boxed().collect(toList()));
-
-            db.add("BitSet.stream.spliterator() {" + description + "}", () ->
-                IntStream.of(exp).collect(BitSet::new, BitSet::set, BitSet::or).
-                        stream().spliterator()
-            );
-        }
         return spliteratorOfIntDataProvider = data.toArray(new Object[0][]);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/SpliteratorOfIntDataBuilder.java	Mon Apr 24 13:43:34 2017 +0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util;
+
+import java.util.function.Supplier;
+
+public class SpliteratorOfIntDataBuilder {
+        List<Object[]> data;
+
+        List<Integer> exp;
+
+        public SpliteratorOfIntDataBuilder(List<Object[]> data, List<Integer> exp) {
+            this.data = data;
+            this.exp = exp;
+        }
+
+        public void add(String description, List<Integer> expected, Supplier<Spliterator.OfInt> s) {
+            description = joiner(description).toString();
+            data.add(new Object[]{description, expected, s});
+        }
+
+        public void add(String description, Supplier<Spliterator.OfInt> s) {
+            add(description, exp, s);
+        }
+
+        StringBuilder joiner(String description) {
+            return new StringBuilder(description).
+                    append(" {").
+                    append("size=").append(exp.size()).
+                    append("}");
+        }
+    }
+