changeset 8081:405a4386eb8b

Include test data set that is an unordeded stream containing nulls
author psandoz
date Wed, 10 Apr 2013 22:22:59 +0200
parents b3a0993879a2
children affe956ed7f8
files test-ng/bootlib/java/util/stream/StreamTestDataProvider.java test-ng/tests/org/openjdk/tests/java/util/stream/DistinctOpTest.java
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test-ng/bootlib/java/util/stream/StreamTestDataProvider.java	Wed Apr 10 14:39:06 2013 -0400
+++ b/test-ng/bootlib/java/util/stream/StreamTestDataProvider.java	Wed Apr 10 22:22:59 2013 +0200
@@ -123,7 +123,10 @@
                     content[e] = (i & (1 << e)) > 0 ? e + 1 : null;
                 }
 
+                // ORDERED
                 list.add(arrayDataDescr("array:" + i, content));
+                // not ORDERED
+                list.add(collectionDataDescr("HashSet:" + i, new HashSet<>(Arrays.asList(content))));
             }
 
             withNullTestData = list.toArray(new Object[0][]);
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Wed Apr 10 14:39:06 2013 -0400
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Wed Apr 10 22:22:59 2013 +0200
@@ -70,16 +70,19 @@
         Collection<Integer> node = exerciseOps(data, s -> s.distinct());
         assertUnique(node);
 
+        node = exerciseOps(data, s -> s.distinct().distinct());
+        assertUnique(node);
+    }
+
+    @Test(dataProvider = "withNull:StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testOpWithNullSorted(String name, StreamTestData<Integer> data) {
         List<Integer> l = new ArrayList<>();
         data.into(l).sort(cNullInteger);
         // Need to inject SORTED into the sorted list source since
         // sorted() with a comparator ironically clears SORTED
-        node = exerciseOps(new SortedTestData<>(l), s -> s.distinct());
+        Collection<Integer> node = exerciseOps(new SortedTestData<>(l), s -> s.distinct());
         assertUnique(node);
         assertSorted(node, cNullInteger);
-
-        node = exerciseOps(data, s -> s.distinct().distinct());
-        assertUnique(node);
     }
 
     @SuppressWarnings("serial")