changeset 7766:2ef914edeba2

Test Corrections. Remove tests obsoleted by API changes. Reviewed-by: mduigou Contributed-by: Amy Lu <amy.lu@oracle.com>
author mduigou
date Wed, 27 Mar 2013 21:17:33 -0700
parents 6f24dfd5e11a
children 06994a5659c8
files test/java/util/function/PredicatesTest.java
diffstat 1 files changed, 1 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/function/PredicatesTest.java	Wed Mar 27 21:16:24 2013 -0700
+++ b/test/java/util/function/PredicatesTest.java	Wed Mar 27 21:17:33 2013 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @tests Basic test for Predicates functional utils
+ * @test Basic test for Predicates functional utils
  * @author  Mike Duigou
  * @run testng PredicatesTest
  */
@@ -50,33 +50,6 @@
     private static final Function<Integer, Integer> f1 = x -> x * 2;
     private static final Function<Integer, Integer> f2 = x -> x * 3;
 
-    private void runNullTest(Object o, boolean expected) {
-        assertEquals(Objects::isNull.test(o), expected);
-        assertEquals(Objects::isNonNull.test(o), !expected);
-        assertEquals(Objects::isNull.negate().test(o), !expected);
-        assertEquals(Objects::isNonNull.negate().test(o), expected);
-        assertEquals(( t -> false ).test(o), false);
-        assertEquals(( t -> true ).test(o), true);
-     }
-
-    @Test
-    public void testIsNull() {
-        List<String> ll = new ArrayList<>(10);
-        ll.add(null);
-        ll.add("test");
-        String str0 = null;
-        String str1 = "null";
-        String str2 = "";
-
-        runNullTest(null, true);
-        runNullTest(1, false);
-        runNullTest(ll.get(0), true);
-        runNullTest(ll.get(1), false);
-        runNullTest(str0, true);
-        runNullTest(str1, false);
-        runNullTest(str2, false);
-    }
-
     @Test
     public void testIsSame() {
         List<Object> l = new ArrayList<>();
@@ -84,7 +57,6 @@
         HashSet<Long> s2 = (HashSet<Long>) s1.clone();
         assertTrue(Predicates.isSame(null).test(null));
         assertTrue(!Predicates.isSame(s2).test(s1));
-        assertTrue(!Predicates.isSame(p).test(Predicates.compose(p, f1)));
         assertTrue(Predicates.isSame(l).test(l));
         assertTrue(!Predicates.isSame(List.class).test(l));
     }
@@ -95,52 +67,6 @@
         HashSet<Long> s2 = (HashSet<Long>) s1.clone();
         assertTrue(Predicates.isEqual(null).test(null));
         assertTrue(Predicates.isEqual(s2).test(s1));
-        assertTrue(!Predicates.isEqual(p).test(Predicates.compose(p, f1)));
-    }
-
-    @Test
-    public void testInstanceOf() {
-        assertTrue(Predicates.instanceOf(List.class).test(new ArrayList<>()));
-        assertTrue(Predicates.instanceOf(Collection.class).test(new Stack<>()));
-        assertTrue(Predicates.instanceOf(Integer.class).test(Integer.SIZE));
-        assertTrue(!Predicates.instanceOf(Double.class).test(Integer.SIZE));
-        assertTrue(!Predicates.instanceOf(Object.class).test(null));
-        assertTrue(Predicates.instanceOf(Predicate.class).test(Predicates.isNull()));
-    }
-
-    @Test
-    public void testContains() {
-        ArrayList<Object> l = new ArrayList<>();
-        HashSet<Integer> s0 = new HashSet<>();
-        HashSet<Long> s1 = new HashSet<>();
-        s0.add(Integer.MAX_VALUE);
-        s0.add(Integer.MIN_VALUE);
-        s1.add(Long.valueOf(Integer.MAX_VALUE) + 1);
-        s1.add(Long.valueOf(Integer.MIN_VALUE) - 1);
-        l.add(s0);
-        l.add(s1);
-        assertTrue(Predicates.contains(s0).test(Integer.MAX_VALUE));
-        assertTrue(Predicates.contains(s0).test(Integer.MIN_VALUE));
-        assertTrue(!Predicates.contains(s0).test(Integer.SIZE));
-        assertTrue(Predicates.contains(s1).test(Long.valueOf(Integer.MAX_VALUE) + 1));
-        assertTrue(Predicates.contains(l).test(s1));
-    }
-
-    @Test
-    public void testCompose() {
-        assertTrue(Predicates.compose(p, f1).test(1));
-        assertTrue(Predicates.compose(p, f1).test(2));
-        assertTrue(Predicates.compose(p, f1).test(0));
-        assertTrue(!Predicates.compose(p, f2).test(1));
-        assertTrue(Predicates.compose(p, f2).test(2));
-    }
-
-    @Test
-    public void testNegate() {
-        Predicate<Integer> predicate = x->x != 0;
-
-        assertTrue(predicate.test(0) != Predicates.negate(predicate).test(0));
-        assertTrue(predicate.test(1) != Predicates.negate(predicate).test(1));
     }
 
     @Test