test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java

Print this page
rev 7485 : 8009736: Comparator API cleanup
Reviewed-by:
Contributed-by: henry.jen@oracle.com

@@ -38,22 +38,22 @@
 @Test
 public class SortedOpTest extends OpTestCase {
     public void testSorted() {
         assertCountSum(countTo(0).stream().sorted(), 0, 0);
         assertCountSum(countTo(10).stream().sorted(), 10, 55);
-        assertCountSum(countTo(10).stream().sorted(cInteger.reverseOrder()), 10, 55);
+        assertCountSum(countTo(10).stream().sorted(cInteger.reversed()), 10, 55);
 
         List<Integer> to10 = countTo(10);
-        assertSorted(to10.stream().sorted(cInteger.reverseOrder()).iterator(), cInteger.reverseOrder());
+        assertSorted(to10.stream().sorted(cInteger.reversed()).iterator(), cInteger.reversed());
 
         Collections.reverse(to10);
         assertSorted(to10.stream().sorted().iterator());
 
         Spliterator<Integer> s = to10.stream().sorted().spliterator();
         assertTrue(s.hasCharacteristics(Spliterator.SORTED));
 
-        s = to10.stream().sorted(cInteger.reverseOrder()).spliterator();
+        s = to10.stream().sorted(cInteger.reversed()).spliterator();
         assertFalse(s.hasCharacteristics(Spliterator.SORTED));
     }
 
     @Test(groups = { "serialization-hostile" })
     public void testSequentialShortCircuitTerminal() {

@@ -85,12 +85,12 @@
     public void testOps(String name, TestData.OfRef<Integer> data) {
         Collection<Integer> result = exerciseOpsInt(data, Stream::sorted, IntStream::sorted, LongStream::sorted, DoubleStream::sorted);
         assertSorted(result.iterator());
         assertContentsUnordered(data, result);
 
-        result = exerciseOps(data, s -> s.sorted(cInteger.reverseOrder()));
-        assertSorted(result.iterator(), cInteger.reverseOrder());
+        result = exerciseOps(data, s -> s.sorted(cInteger.reversed()));
+        assertSorted(result.iterator(), cInteger.reversed());
         assertContentsUnordered(data, result);
     }
 
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
     public void testSortSort(String name, TestData.OfRef<Integer> data) {

@@ -102,27 +102,27 @@
 
         assertSorted(result);
         assertContentsUnordered(data, result);
 
         result = withData(data)
-                .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(cInteger.reverseOrder()),
+                .stream(s -> s.sorted(cInteger.reversed()).sorted(cInteger.reversed()),
                         new CollectorOps.TestParallelSizedOp<Integer>())
                 .exercise();
 
-        assertSorted(result, cInteger.reverseOrder());
+        assertSorted(result, cInteger.reversed());
         assertContentsUnordered(data, result);
 
         result = withData(data)
-                .stream(s -> s.sorted().sorted(cInteger.reverseOrder()),
+                .stream(s -> s.sorted().sorted(cInteger.reversed()),
                         new CollectorOps.TestParallelSizedOp<Integer>())
                 .exercise();
 
-        assertSorted(result, cInteger.reverseOrder());
+        assertSorted(result, cInteger.reversed());
         assertContentsUnordered(data, result);
 
         result = withData(data)
-                .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(),
+                .stream(s -> s.sorted(cInteger.reversed()).sorted(),
                         new CollectorOps.TestParallelSizedOp<Integer>())
                 .exercise();
 
         assertSorted(result);
         assertContentsUnordered(data, result);