Author: bayard Date: Tue Sep 15 05:58:13 2009 New Revision: 815153 URL: http://svn.apache.org/viewvc?rev=815153&view=rev Log: Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r643795 | skestle | 2008-04-02 01:49:57 -0700 (Wed, 02 Apr 2008) | 5 lines Generified EqualPredicate and created individual test class moved from TestPredicateUtils Added assertFalse() and assertTrue to BasicPredicateTestBase with (Predicate, Object) parameters Issues: COLLECTIONS-243, COLLECTIONS-253, COLLECTIONS-293 ------------------------------------------------------------------------ r643782 | skestle | 2008-04-02 01:00:00 -0700 (Wed, 02 Apr 2008) | 5 lines Generified NullPredicate and created individual test class moved on TestPredicateUtils Renamed PredicateTestBase to MockPredicateTestBase to reduce confusion and added BasicPredicateTestBase. Issues: COLLECTIONS-243, COLLECTIONS-253, COLLECTIONS-293 ------------------------------------------------------------------------ Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestPredicateUtils.java Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestPredicateUtils.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestPredicateUtils.java?rev=815153&r1=815152&r2=815153&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestPredicateUtils.java (original) +++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestPredicateUtils.java Tue Sep 15 05:58:13 2009 @@ -16,6 +16,13 @@ */ package org.apache.commons.collections; +import static org.apache.commons.collections.functors.NullPredicate.nullPredicate; +import static org.apache.commons.collections.functors.TruePredicate.truePredicate; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -23,10 +30,12 @@ import java.util.List; import java.util.Map; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; +import org.apache.commons.collections.functors.AllPredicate; +import org.apache.commons.collections.functors.BasicPredicateTestBase; +import org.apache.commons.collections.functors.EqualPredicate; +import org.apache.commons.collections.functors.FalsePredicate; +import org.apache.commons.collections.functors.TruePredicate; +import org.junit.Test; /** * Tests the org.apache.commons.collections.PredicateUtils class. @@ -37,34 +46,7 @@ * @author Stephen Colebourne * @author Matt Benson */ -public class TestPredicateUtils extends junit.framework.TestCase { - - private static final Object cObject = new Object(); - private static final Object cString = "Hello"; - private static final Object cInteger = new Integer(6); - - /** - * Construct - */ - public TestPredicateUtils(String name) { - super(name); - } - - /** - * Main. - * @param args - */ - public static void main(String[] args) { - TestRunner.run(suite()); - } - - /** - * Return class as a test suite. - */ - public static Test suite() { - return new TestSuite(TestPredicateUtils.class); - } - +public class TestPredicateUtils extends BasicPredicateTestBase { /** * Set up instance variables required by this test case. */ @@ -80,7 +62,7 @@ // exceptionPredicate //------------------------------------------------------------------ - public void testExceptionPredicate() { + @Test public void testExceptionPredicate() { assertNotNull(PredicateUtils.exceptionPredicate()); assertSame(PredicateUtils.exceptionPredicate(), PredicateUtils.exceptionPredicate()); try { @@ -94,23 +76,11 @@ } fail(); } - - // nullPredicate - //------------------------------------------------------------------ - - public void testNullPredicate() { - assertNotNull(PredicateUtils.nullPredicate()); - assertSame(PredicateUtils.nullPredicate(), PredicateUtils.nullPredicate()); - assertEquals(true, PredicateUtils.nullPredicate().evaluate(null)); - assertEquals(false, PredicateUtils.nullPredicate().evaluate(cObject)); - assertEquals(false, PredicateUtils.nullPredicate().evaluate(cString)); - assertEquals(false, PredicateUtils.nullPredicate().evaluate(cInteger)); - } // notNullPredicate //------------------------------------------------------------------ - public void testIsNotNullPredicate() { + @Test public void testIsNotNullPredicate() { assertNotNull(PredicateUtils.notNullPredicate()); assertSame(PredicateUtils.notNullPredicate(), PredicateUtils.notNullPredicate()); assertEquals(false, PredicateUtils.notNullPredicate().evaluate(null)); @@ -119,27 +89,15 @@ assertEquals(true, PredicateUtils.notNullPredicate().evaluate(cInteger)); } - // equalPredicate - //------------------------------------------------------------------ - - public void testEqualPredicate() { - assertSame(PredicateUtils.nullPredicate(), PredicateUtils.equalPredicate(null)); - assertNotNull(PredicateUtils.equalPredicate(new Integer(6))); - assertEquals(false, PredicateUtils.equalPredicate(new Integer(6)).evaluate(null)); - assertEquals(false, PredicateUtils.equalPredicate(new Integer(6)).evaluate(cObject)); - assertEquals(false, PredicateUtils.equalPredicate(new Integer(6)).evaluate(cString)); - assertEquals(true, PredicateUtils.equalPredicate(new Integer(6)).evaluate(cInteger)); - } - // identityPredicate //------------------------------------------------------------------ - public void testIdentityPredicate() { - assertSame(PredicateUtils.nullPredicate(), PredicateUtils.identityPredicate(null)); + @Test public void testIdentityPredicate() { + assertSame(nullPredicate(), PredicateUtils.identityPredicate(null)); assertNotNull(PredicateUtils.identityPredicate(new Integer(6))); assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(null)); - assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cObject)); - assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cString)); + assertEquals(false, PredicateUtils.<Object>identityPredicate(new Integer(6)).evaluate(cObject)); + assertEquals(false, PredicateUtils.<Object>identityPredicate(new Integer(6)).evaluate(cString)); assertEquals(false, PredicateUtils.identityPredicate(new Integer(6)).evaluate(cInteger)); assertEquals(true, PredicateUtils.identityPredicate(cInteger).evaluate(cInteger)); } @@ -147,39 +105,39 @@ // truePredicate //------------------------------------------------------------------ - public void testTruePredicate() { - assertNotNull(PredicateUtils.truePredicate()); - assertSame(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()); - assertEquals(true, PredicateUtils.truePredicate().evaluate(null)); - assertEquals(true, PredicateUtils.truePredicate().evaluate(cObject)); - assertEquals(true, PredicateUtils.truePredicate().evaluate(cString)); - assertEquals(true, PredicateUtils.truePredicate().evaluate(cInteger)); + @Test public void testTruePredicate() { + assertNotNull(TruePredicate.truePredicate()); + assertSame(TruePredicate.truePredicate(), TruePredicate.truePredicate()); + assertEquals(true, TruePredicate.truePredicate().evaluate(null)); + assertEquals(true, TruePredicate.truePredicate().evaluate(cObject)); + assertEquals(true, TruePredicate.truePredicate().evaluate(cString)); + assertEquals(true, TruePredicate.truePredicate().evaluate(cInteger)); } // falsePredicate //------------------------------------------------------------------ - public void testFalsePredicate() { - assertNotNull(PredicateUtils.falsePredicate()); - assertSame(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()); - assertEquals(false, PredicateUtils.falsePredicate().evaluate(null)); - assertEquals(false, PredicateUtils.falsePredicate().evaluate(cObject)); - assertEquals(false, PredicateUtils.falsePredicate().evaluate(cString)); - assertEquals(false, PredicateUtils.falsePredicate().evaluate(cInteger)); + @Test public void testFalsePredicate() { + assertNotNull(FalsePredicate.falsePredicate()); + assertSame(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()); + assertEquals(false, FalsePredicate.falsePredicate().evaluate(null)); + assertEquals(false, FalsePredicate.falsePredicate().evaluate(cObject)); + assertEquals(false, FalsePredicate.falsePredicate().evaluate(cString)); + assertEquals(false, FalsePredicate.falsePredicate().evaluate(cInteger)); } // notPredicate //------------------------------------------------------------------ - public void testNotPredicate() { - assertNotNull(PredicateUtils.notPredicate(PredicateUtils.truePredicate())); - assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cObject)); - assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cString)); - assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.truePredicate()).evaluate(cInteger)); + @Test public void testNotPredicate() { + assertNotNull(PredicateUtils.notPredicate(TruePredicate.truePredicate())); + assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cObject)); + assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cString)); + assertEquals(false, PredicateUtils.notPredicate(TruePredicate.truePredicate()).evaluate(cInteger)); } - - public void testNotPredicateEx() { + + @Test public void testNotPredicateEx() { try { PredicateUtils.notPredicate(null); } catch (IllegalArgumentException ex) { @@ -187,18 +145,18 @@ } fail(); } - + // andPredicate //------------------------------------------------------------------ - public void testAndPredicate() { - assertEquals(true, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); + @Test public void testAndPredicate() { + assertEquals(true, PredicateUtils.andPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.andPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.andPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.andPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); } - public void testAndPredicateEx() { + @Test public void testAndPredicateEx() { try { PredicateUtils.andPredicate(null, null); } catch (IllegalArgumentException ex) { @@ -206,114 +164,117 @@ } fail(); } - + // allPredicate //------------------------------------------------------------------ - public void testAllPredicate() { - assertTrue(PredicateUtils.allPredicate( - new Predicate[] {}).evaluate(null)); - assertEquals(true, PredicateUtils.allPredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); - assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); - assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); - assertEquals(false, PredicateUtils.allPredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); - Collection coll = new ArrayList(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); - assertEquals(true, PredicateUtils.allPredicate(coll).evaluate(null)); + @SuppressWarnings("unchecked") + @Test public void testAllPredicate() { + assertTrue(AllPredicate.allPredicate(new Predicate[] {}), null); + assertEquals(true, AllPredicate.allPredicate(new Predicate[] { + TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null)); + assertEquals(false, AllPredicate.allPredicate(new Predicate[] { + TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); + assertEquals(false, AllPredicate.allPredicate(new Predicate[] { + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); + assertEquals(false, AllPredicate.allPredicate(new Predicate[] { + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null)); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); + assertEquals(true, AllPredicate.allPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); - assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); + coll.add(TruePredicate.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); + assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); - assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); + assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + assertEquals(false, AllPredicate.allPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - assertFalse(PredicateUtils.allPredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + assertFalse(AllPredicate.allPredicate(coll), null); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - assertTrue(PredicateUtils.allPredicate(coll).evaluate(null)); + coll.add(TruePredicate.truePredicate()); + assertTrue(AllPredicate.allPredicate(coll), null); coll.clear(); - assertTrue(PredicateUtils.allPredicate(coll).evaluate(null)); + assertTrue(AllPredicate.allPredicate(coll), null); } - public void testAllPredicateEx1() { + @SuppressWarnings("unchecked") + @Test public void testAllPredicateEx1() { try { - PredicateUtils.allPredicate((Predicate[]) null); + AllPredicate.allPredicate((Predicate[]) null); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testAllPredicateEx2() { + + @SuppressWarnings("unchecked") + @Test public void testAllPredicateEx2() { try { - PredicateUtils.allPredicate(new Predicate[] {null}); + AllPredicate.<Object>allPredicate(new Predicate[] { null }); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testAllPredicateEx3() { + + @SuppressWarnings("unchecked") + @Test public void testAllPredicateEx3() { try { - PredicateUtils.allPredicate(new Predicate[] {null, null}); + AllPredicate.allPredicate(new Predicate[] { null, null }); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testAllPredicateEx4() { + + @Test public void testAllPredicateEx4() { try { - PredicateUtils.allPredicate((Collection) null); + AllPredicate.allPredicate((Collection<Predicate<Object>>) null); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testAllPredicateEx5() { - PredicateUtils.allPredicate(Collections.EMPTY_LIST); + + @Test public void testAllPredicateEx5() { + AllPredicate.allPredicate(Collections.<Predicate<Object>>emptyList()); } - - public void testAllPredicateEx6() { + + @Test public void testAllPredicateEx6() { try { - Collection coll = new ArrayList(); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); coll.add(null); coll.add(null); - PredicateUtils.allPredicate(coll); + AllPredicate.allPredicate(coll); } catch (IllegalArgumentException ex) { return; } fail(); } - + // orPredicate //------------------------------------------------------------------ - public void testOrPredicate() { - assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.orPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); + @Test public void testOrPredicate() { + assertEquals(true, PredicateUtils.orPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.orPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.orPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.orPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); } - - public void testOrPredicateEx() { + + @Test public void testOrPredicateEx() { try { PredicateUtils.orPredicate(null, null); } catch (IllegalArgumentException ex) { @@ -321,52 +282,54 @@ } fail(); } - + // anyPredicate //------------------------------------------------------------------ - public void testAnyPredicate() { - assertFalse(PredicateUtils.anyPredicate( - new Predicate[] {}).evaluate(null)); + @SuppressWarnings("unchecked") + @Test public void testAnyPredicate() { + assertFalse(PredicateUtils.anyPredicate(new Predicate[] {}), null); + assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.anyPredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); assertEquals(false, PredicateUtils.anyPredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - assertFalse(PredicateUtils.anyPredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + assertFalse(PredicateUtils.anyPredicate(coll), null); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - assertTrue(PredicateUtils.anyPredicate(coll).evaluate(null)); + coll.add(TruePredicate.truePredicate()); + assertTrue(PredicateUtils.anyPredicate(coll), null); coll.clear(); - assertFalse(PredicateUtils.anyPredicate(coll).evaluate(null)); + assertFalse(PredicateUtils.anyPredicate(coll), null); } - public void testAnyPredicateEx1() { + @SuppressWarnings("unchecked") + @Test public void testAnyPredicateEx1() { try { PredicateUtils.anyPredicate((Predicate[]) null); } catch (IllegalArgumentException ex) { @@ -374,8 +337,9 @@ } fail(); } - - public void testAnyPredicateEx2() { + + @SuppressWarnings("unchecked") + @Test public void testAnyPredicateEx2() { try { PredicateUtils.anyPredicate(new Predicate[] {null}); } catch (IllegalArgumentException ex) { @@ -383,8 +347,9 @@ } fail(); } - - public void testAnyPredicateEx3() { + + @SuppressWarnings("unchecked") + @Test public void testAnyPredicateEx3() { try { PredicateUtils.anyPredicate(new Predicate[] {null, null}); } catch (IllegalArgumentException ex) { @@ -392,23 +357,23 @@ } fail(); } - - public void testAnyPredicateEx4() { + + @Test public void testAnyPredicateEx4() { try { - PredicateUtils.anyPredicate((Collection) null); + PredicateUtils.anyPredicate((Collection<Predicate<Object>>) null); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testAnyPredicateEx5() { - PredicateUtils.anyPredicate(Collections.EMPTY_LIST); + + @Test public void testAnyPredicateEx5() { + PredicateUtils.anyPredicate(Collections.<Predicate<Object>>emptyList()); } - - public void testAnyPredicateEx6() { + + @Test public void testAnyPredicateEx6() { try { - Collection coll = new ArrayList(); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); coll.add(null); coll.add(null); PredicateUtils.anyPredicate(coll); @@ -417,18 +382,18 @@ } fail(); } - + // eitherPredicate //------------------------------------------------------------------ - public void testEitherPredicate() { - assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); + @Test public void testEitherPredicate() { + assertEquals(false, PredicateUtils.eitherPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.eitherPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.eitherPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.eitherPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); } - public void testEitherPredicateEx() { + @Test public void testEitherPredicateEx() { try { PredicateUtils.eitherPredicate(null, null); } catch (IllegalArgumentException ex) { @@ -436,56 +401,57 @@ } fail(); } - + // onePredicate //------------------------------------------------------------------ - public void testOnePredicate() { - assertFalse(PredicateUtils.onePredicate( - new Predicate[] {}).evaluate(null)); + @SuppressWarnings("unchecked") + @Test public void testOnePredicate() { + assertFalse(PredicateUtils.onePredicate((Predicate<Object>[]) new Predicate[] {}), null); assertEquals(false, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); + FalsePredicate.falsePredicate(), TruePredicate.truePredicate(), FalsePredicate.falsePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.onePredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); - Collection coll = new ArrayList(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()}).evaluate(null)); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(true, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - assertFalse(PredicateUtils.onePredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + assertFalse(PredicateUtils.onePredicate(coll), null); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - assertTrue(PredicateUtils.onePredicate(coll).evaluate(null)); + coll.add(TruePredicate.truePredicate()); + assertTrue(PredicateUtils.onePredicate(coll), null); coll.clear(); - assertFalse(PredicateUtils.onePredicate(coll).evaluate(null)); + assertFalse(PredicateUtils.onePredicate(coll), null); } - public void testOnePredicateEx1() { + @SuppressWarnings("unchecked") + @Test public void testOnePredicateEx1() { try { PredicateUtils.onePredicate((Predicate[]) null); } catch (IllegalArgumentException ex) { @@ -493,8 +459,9 @@ } fail(); } - - public void testOnePredicateEx2() { + + @SuppressWarnings("unchecked") + @Test public void testOnePredicateEx2() { try { PredicateUtils.onePredicate(new Predicate[] {null}); } catch (IllegalArgumentException ex) { @@ -502,8 +469,9 @@ } fail(); } - - public void testOnePredicateEx3() { + + @SuppressWarnings("unchecked") + @Test public void testOnePredicateEx3() { try { PredicateUtils.onePredicate(new Predicate[] {null, null}); } catch (IllegalArgumentException ex) { @@ -511,8 +479,9 @@ } fail(); } - - public void testOnePredicateEx4() { + + @SuppressWarnings("unchecked") + @Test public void testOnePredicateEx4() { try { PredicateUtils.onePredicate((Collection) null); } catch (IllegalArgumentException ex) { @@ -520,14 +489,15 @@ } fail(); } - - public void testOnePredicateEx5() { + + @SuppressWarnings("unchecked") + @Test public void testOnePredicateEx5() { PredicateUtils.onePredicate(Collections.EMPTY_LIST); } - - public void testOnePredicateEx6() { + + @Test public void testOnePredicateEx6() { try { - Collection coll = new ArrayList(); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); coll.add(null); coll.add(null); PredicateUtils.onePredicate(coll); @@ -536,18 +506,18 @@ } fail(); } - + // neitherPredicate //------------------------------------------------------------------ - public void testNeitherPredicate() { - assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); - assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.neitherPredicate(PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()).evaluate(null)); + @Test public void testNeitherPredicate() { + assertEquals(false, PredicateUtils.neitherPredicate(TruePredicate.truePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.neitherPredicate(TruePredicate.truePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); + assertEquals(false, PredicateUtils.neitherPredicate(FalsePredicate.falsePredicate(), TruePredicate.truePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.neitherPredicate(FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate()).evaluate(null)); } - public void testNeitherPredicateEx() { + @Test public void testNeitherPredicateEx() { try { PredicateUtils.neitherPredicate(null, null); } catch (IllegalArgumentException ex) { @@ -555,52 +525,53 @@ } fail(); } - + // nonePredicate //------------------------------------------------------------------ - public void testNonePredicate() { - assertTrue(PredicateUtils.nonePredicate( - new Predicate[] {}).evaluate(null)); + @SuppressWarnings("unchecked") + @Test public void testNonePredicate() { + assertTrue(PredicateUtils.nonePredicate(new Predicate[] {}), null); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), TruePredicate.truePredicate(), TruePredicate.truePredicate() }).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { - PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + TruePredicate.truePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate() }).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), TruePredicate.truePredicate() }).evaluate(null)); assertEquals(true, PredicateUtils.nonePredicate(new Predicate[] { - PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); - Collection coll = new ArrayList(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.truePredicate()); + FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate(), FalsePredicate.falsePredicate() }).evaluate(null)); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(TruePredicate.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.truePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(TruePredicate.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); - coll.add(PredicateUtils.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); + coll.add(FalsePredicate.falsePredicate()); assertEquals(true, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); - coll.add(PredicateUtils.falsePredicate()); - assertTrue(PredicateUtils.nonePredicate(coll).evaluate(null)); + coll.add(FalsePredicate.falsePredicate()); + assertTrue(PredicateUtils.nonePredicate(coll), null); coll.clear(); - coll.add(PredicateUtils.truePredicate()); - assertFalse(PredicateUtils.nonePredicate(coll).evaluate(null)); + coll.add(TruePredicate.truePredicate()); + assertFalse(PredicateUtils.nonePredicate(coll), null); coll.clear(); - assertTrue(PredicateUtils.nonePredicate(coll).evaluate(null)); + assertTrue(PredicateUtils.nonePredicate(coll), null); } - public void testNonePredicateEx1() { + @SuppressWarnings("unchecked") + @Test public void testNonePredicateEx1() { try { PredicateUtils.nonePredicate((Predicate[]) null); } catch (IllegalArgumentException ex) { @@ -608,8 +579,9 @@ } fail(); } - - public void testNonePredicateEx2() { + + @SuppressWarnings("unchecked") + @Test public void testNonePredicateEx2() { try { PredicateUtils.nonePredicate(new Predicate[] {null}); } catch (IllegalArgumentException ex) { @@ -617,8 +589,9 @@ } fail(); } - - public void testNonePredicateEx3() { + + @SuppressWarnings("unchecked") + @Test public void testNonePredicateEx3() { try { PredicateUtils.nonePredicate(new Predicate[] {null, null}); } catch (IllegalArgumentException ex) { @@ -626,23 +599,23 @@ } fail(); } - - public void testNonePredicateEx4() { + + @Test public void testNonePredicateEx4() { try { - PredicateUtils.nonePredicate((Collection) null); + PredicateUtils.nonePredicate((Collection<Predicate<Object>>) null); } catch (IllegalArgumentException ex) { return; } fail(); } - - public void testNonePredicateEx5() { - PredicateUtils.nonePredicate(Collections.EMPTY_LIST); + + @Test public void testNonePredicateEx5() { + PredicateUtils.nonePredicate(Collections.<Predicate<Object>>emptyList()); } - - public void testNonePredicateEx6() { + + @Test public void testNonePredicateEx6() { try { - Collection coll = new ArrayList(); + Collection<Predicate<Object>> coll = new ArrayList<Predicate<Object>>(); coll.add(null); coll.add(null); PredicateUtils.nonePredicate(coll); @@ -651,11 +624,11 @@ } fail(); } - + // instanceofPredicate //------------------------------------------------------------------ - public void testInstanceOfPredicate() { + @Test public void testInstanceOfPredicate() { assertNotNull(PredicateUtils.instanceofPredicate(String.class)); assertEquals(false, PredicateUtils.instanceofPredicate(String.class).evaluate(null)); assertEquals(false, PredicateUtils.instanceofPredicate(String.class).evaluate(cObject)); @@ -666,8 +639,8 @@ // uniquePredicate //------------------------------------------------------------------ - public void testUniquePredicate() { - Predicate p = PredicateUtils.uniquePredicate(); + @Test public void testUniquePredicate() { + Predicate<Object> p = PredicateUtils.uniquePredicate(); assertEquals(true, p.evaluate(new Object())); assertEquals(true, p.evaluate(new Object())); assertEquals(true, p.evaluate(new Object())); @@ -675,16 +648,16 @@ assertEquals(false, p.evaluate(cString)); assertEquals(false, p.evaluate(cString)); } - + // asPredicate(Transformer) //------------------------------------------------------------------ - public void testAsPredicateTransformer() { - assertEquals(false, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.FALSE)); - assertEquals(true, PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.TRUE)); + @Test public void testAsPredicateTransformer() { + assertEquals(false, PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(false)); + assertEquals(true, PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(true)); } - public void testAsPredicateTransformerEx1() { + @Test public void testAsPredicateTransformerEx1() { try { PredicateUtils.asPredicate(null); } catch (IllegalArgumentException ex) { @@ -692,27 +665,27 @@ } fail(); } - - public void testAsPredicateTransformerEx2() { + + @Test public void testAsPredicateTransformerEx2() { try { - PredicateUtils.asPredicate(TransformerUtils.nopTransformer()).evaluate(null); + PredicateUtils.asPredicate(TransformerUtils.<Boolean>nopTransformer()).evaluate(null); } catch (FunctorException ex) { return; } fail(); } - + // invokerPredicate //------------------------------------------------------------------ - public void testInvokerPredicate() { - List list = new ArrayList(); + @Test public void testInvokerPredicate() { + List<Object> list = new ArrayList<Object>(); assertEquals(true, PredicateUtils.invokerPredicate("isEmpty").evaluate(list)); list.add(new Object()); assertEquals(false, PredicateUtils.invokerPredicate("isEmpty").evaluate(list)); } - public void testInvokerPredicateEx1() { + @Test public void testInvokerPredicateEx1() { try { PredicateUtils.invokerPredicate(null); } catch (IllegalArgumentException ex) { @@ -720,8 +693,8 @@ } fail(); } - - public void testInvokerPredicateEx2() { + + @Test public void testInvokerPredicateEx2() { try { PredicateUtils.invokerPredicate("isEmpty").evaluate(null); } catch (FunctorException ex) { @@ -729,8 +702,8 @@ } fail(); } - - public void testInvokerPredicateEx3() { + + @Test public void testInvokerPredicateEx3() { try { PredicateUtils.invokerPredicate("noSuchMethod").evaluate(new Object()); } catch (FunctorException ex) { @@ -738,12 +711,12 @@ } fail(); } - + // invokerPredicate2 //------------------------------------------------------------------ - public void testInvokerPredicate2() { - List list = new ArrayList(); + @Test public void testInvokerPredicate2() { + List<String> list = new ArrayList<String>(); assertEquals(false, PredicateUtils.invokerPredicate( "contains", new Class[] {Object.class}, new Object[] {cString}).evaluate(list)); list.add(cString); @@ -751,7 +724,7 @@ "contains", new Class[] {Object.class}, new Object[] {cString}).evaluate(list)); } - public void testInvokerPredicate2Ex1() { + @Test public void testInvokerPredicate2Ex1() { try { PredicateUtils.invokerPredicate(null, null, null); } catch (IllegalArgumentException ex) { @@ -759,8 +732,8 @@ } fail(); } - - public void testInvokerPredicate2Ex2() { + + @Test public void testInvokerPredicate2Ex2() { try { PredicateUtils.invokerPredicate("contains", new Class[] {Object.class}, new Object[] {cString}).evaluate(null); } catch (FunctorException ex) { @@ -768,8 +741,8 @@ } fail(); } - - public void testInvokerPredicate2Ex3() { + + @Test public void testInvokerPredicate2Ex3() { try { PredicateUtils.invokerPredicate( "noSuchMethod", new Class[] {Object.class}, new Object[] {cString}).evaluate(new Object()); @@ -778,21 +751,21 @@ } fail(); } - + // nullIsException //------------------------------------------------------------------ - public void testNullIsExceptionPredicate() { - assertEquals(true, PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(new Object())); + @Test public void testNullIsExceptionPredicate() { + assertEquals(true, PredicateUtils.nullIsExceptionPredicate(TruePredicate.truePredicate()).evaluate(new Object())); try { - PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(null); + PredicateUtils.nullIsExceptionPredicate(TruePredicate.truePredicate()).evaluate(null); } catch (FunctorException ex) { return; } fail(); } - public void testNullIsExceptionPredicateEx1() { + @Test public void testNullIsExceptionPredicateEx1() { try { PredicateUtils.nullIsExceptionPredicate(null); } catch (IllegalArgumentException ex) { @@ -800,17 +773,17 @@ } fail(); } - + // nullIsTrue //------------------------------------------------------------------ - public void testNullIsTruePredicate() { - assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.nullIsTruePredicate(PredicateUtils.truePredicate()).evaluate(new Object())); - assertEquals(false, PredicateUtils.nullIsTruePredicate(PredicateUtils.falsePredicate()).evaluate(new Object())); + @Test public void testNullIsTruePredicate() { + assertEquals(true, PredicateUtils.nullIsTruePredicate(TruePredicate.truePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.nullIsTruePredicate(TruePredicate.truePredicate()).evaluate(new Object())); + assertEquals(false, PredicateUtils.nullIsTruePredicate(FalsePredicate.falsePredicate()).evaluate(new Object())); } - public void testNullIsTruePredicateEx1() { + @Test public void testNullIsTruePredicateEx1() { try { PredicateUtils.nullIsTruePredicate(null); } catch (IllegalArgumentException ex) { @@ -818,17 +791,17 @@ } fail(); } - + // nullIsFalse //------------------------------------------------------------------ - public void testNullIsFalsePredicate() { - assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(null)); - assertEquals(true, PredicateUtils.nullIsFalsePredicate(PredicateUtils.truePredicate()).evaluate(new Object())); - assertEquals(false, PredicateUtils.nullIsFalsePredicate(PredicateUtils.falsePredicate()).evaluate(new Object())); + @Test public void testNullIsFalsePredicate() { + assertEquals(false, PredicateUtils.nullIsFalsePredicate(TruePredicate.truePredicate()).evaluate(null)); + assertEquals(true, PredicateUtils.nullIsFalsePredicate(TruePredicate.truePredicate()).evaluate(new Object())); + assertEquals(false, PredicateUtils.nullIsFalsePredicate(FalsePredicate.falsePredicate()).evaluate(new Object())); } - public void testNullIsFalsePredicateEx1() { + @Test public void testNullIsFalsePredicateEx1() { try { PredicateUtils.nullIsFalsePredicate(null); } catch (IllegalArgumentException ex) { @@ -836,19 +809,19 @@ } fail(); } - + // transformed //------------------------------------------------------------------ - public void testTransformedPredicate() { + @Test public void testTransformedPredicate() { assertEquals(true, PredicateUtils.transformedPredicate( TransformerUtils.nopTransformer(), - PredicateUtils.truePredicate()).evaluate(new Object())); - - Map map = new HashMap(); + TruePredicate.truePredicate()).evaluate(new Object())); + + Map<Object, Object> map = new HashMap<Object, Object>(); map.put(Boolean.TRUE, "Hello"); - Transformer t = TransformerUtils.mapTransformer(map); - Predicate p = PredicateUtils.equalPredicate("Hello"); + Transformer<Object, Object> t = TransformerUtils.mapTransformer(map); + Predicate<Object> p = EqualPredicate.<Object>equalPredicate("Hello"); assertEquals(false, PredicateUtils.transformedPredicate(t, p).evaluate(null)); assertEquals(true, PredicateUtils.transformedPredicate(t, p).evaluate(Boolean.TRUE)); try { @@ -857,4 +830,9 @@ } catch (IllegalArgumentException ex) {} } + @Override + protected Predicate<?> generatePredicate() { + return truePredicate(); //Just return something to satisfy super class. + } + }