changeset 7620:c4384d0a2706

fix test breakage
author mduigou
date Tue, 12 Mar 2013 17:45:56 -0700
parents 1047164c8255
children 622996f1e9f2
files test/java/util/ComparatorsTest.java
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/ComparatorsTest.java	Tue Mar 12 17:10:50 2013 -0700
+++ b/test/java/util/ComparatorsTest.java	Tue Mar 12 17:45:56 2013 -0700
@@ -179,16 +179,11 @@
         assertTrue(cmpr.compare("abc", "defg") > 0);
     }
 
-    @Test(expectedExceptions=NullPointerException.class)
-    public void testReverseComparatorNPE() {
-        Comparator<String> cmp = Comparators.reverseOrder(null);
-    }
-
     public void testComposeComparator() {
         // Longer string in front
         Comparator<String> first = (s1, s2) -> s2.length() - s1.length();
         Comparator<String> second = Comparators.naturalOrder();
-        Comparator<String> composed = Comparators.compose(first, second);
+        Comparator<String> composed = first.thenComparing(second);
 
         assertTrue(composed.compare("abcdefg", "abcdef") < 0);
         assertTrue(composed.compare("abcdef", "abcdefg") > 0);
@@ -221,7 +216,7 @@
         assertTrue(cv.compare(p21, p11) == 0);
         assertTrue(cv.compare(p21, p12) < 0);
 
-        Comparator<Map.Entry<K, V>> cmp = Comparators.compose(ck, cv);
+        Comparator<Map.Entry<K, V>> cmp = ck.thenComparing(cv);
         assertTrue(cmp.compare(p11, p11) == 0);
         assertTrue(cmp.compare(p12, p11) > 0);
         assertTrue(cmp.compare(p11, p12) < 0);
@@ -230,7 +225,7 @@
         assertTrue(cmp.compare(p21, p11) > 0);
         assertTrue(cmp.compare(p21, p12) > 0);
 
-        cmp = Comparators.compose(cv, ck);
+        cmp = cv.thenComparing(ck);
         assertTrue(cmp.compare(p11, p11) == 0);
         assertTrue(cmp.compare(p12, p11) > 0);
         assertTrue(cmp.compare(p11, p12) < 0);
@@ -279,7 +274,7 @@
         // Thus choose to do compose for some level of interation.
         Comparator<People> cmp1 = Comparators.comparing((Function<People, String>) People::getFirstName);
         Comparator<People> cmp2 = Comparators.comparing((Function<People, String>) People::getLastName);
-        Comparator<People> cmp = Comparators.compose(cmp1, cmp2);
+        Comparator<People> cmp = cmp1.thenComparing(cmp2);
 
         assertPairComparison(people[0], people[0], people[1], people[1],
                          Comparators.<People, People>byKey(cmp),
@@ -350,4 +345,4 @@
                               .apply(people[0], people[1]),
                    people[1]);
     }
-}
\ No newline at end of file
+}