commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/predicate TestPredicateUtils.java
Date Sat, 20 Jul 2002 14:48:26 GMT
scolebourne    2002/07/20 07:48:26

  Modified:    pattern/src/test/org/apache/commons/pattern/factory
                        TestFactoryUtils.java
               pattern/src/test/org/apache/commons/pattern/predicate
                        TestPredicateUtils.java
  Added:       pattern/src/test/org/apache/commons/pattern/transformer
                        TestTransformerUtils.java TransformerTestSuite.java
  Log:
  Test pattern interface utils
  
  Revision  Changes    Path
  1.4       +19 -1     jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/factory/TestFactoryUtils.java
  
  Index: TestFactoryUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/factory/TestFactoryUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestFactoryUtils.java	29 Jun 2002 12:49:26 -0000	1.3
  +++ TestFactoryUtils.java	20 Jul 2002 14:48:26 -0000	1.4
  @@ -95,6 +95,24 @@
       public void tearDown() {
       }
   
  +    // exceptionFactory
  +    //------------------------------------------------------------------
  +
  +    public void testExceptionFactory() {
  +        assertNotNull(FactoryUtils.exceptionFactory());
  +        assertSame(FactoryUtils.exceptionFactory(), FactoryUtils.exceptionFactory());
  +        try {
  +            FactoryUtils.exceptionFactory().create();
  +        } catch (FactoryException ex) {
  +            try {
  +                FactoryUtils.exceptionFactory().create();
  +            } catch (FactoryException ex2) {
  +                return;
  +            }
  +        }
  +        fail();
  +    }
  +    
       // nullFactory
       //------------------------------------------------------------------
       
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/transformer/TestTransformerUtils.java
  
  Index: TestTransformerUtils.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.pattern.transformer;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.Date;
  import java.util.HashMap;
  import java.util.Map;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.lang.SerializationException;
  import org.apache.commons.pattern.factory.FactoryUtils;
  import org.apache.commons.pattern.predicate.Predicate;
  import org.apache.commons.pattern.predicate.PredicateUtils;
  /**
   * Tests the org.apache.commons.pattern.predicate.PredicateUtils class.
   *
   * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
   * @version $Id: TestTransformerUtils.java,v 1.1 2002/07/20 14:48:26 scolebourne Exp $
   */
  public class TestTransformerUtils 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 TestTransformerUtils(String name) {
          super(name);
      }
  
      /**
       * Return class aa a test suite.
       */
      public static Test suite() {
          return new TestSuite(TestTransformerUtils.class);
      }
  
      /**
       * Set up instance variables required by this test case.
       */
      public void setUp() {
      }
  
      /**
       * Tear down instance variables required by this test case.
       */
      public void tearDown() {
      }
  
      // exceptionTransformer
      //------------------------------------------------------------------
  
      public void testExceptionTransformer() {
          assertNotNull(TransformerUtils.exceptionTransformer());
          assertSame(TransformerUtils.exceptionTransformer(), TransformerUtils.exceptionTransformer());
          try {
              TransformerUtils.exceptionTransformer().transform(null);
          } catch (TransformerException ex) {
              try {
                  TransformerUtils.exceptionTransformer().transform(cString);
              } catch (TransformerException ex2) {
                  return;
              }
          }
          fail();
      }
      
      // nullTransformer
      //------------------------------------------------------------------
  
      public void testNullTransformer() {
          assertNotNull(TransformerUtils.nullTransformer());
          assertSame(TransformerUtils.nullTransformer(), TransformerUtils.nullTransformer());
          assertEquals(null, TransformerUtils.nullTransformer().transform(null));
          assertEquals(null, TransformerUtils.nullTransformer().transform(cObject));
          assertEquals(null, TransformerUtils.nullTransformer().transform(cString));
          assertEquals(null, TransformerUtils.nullTransformer().transform(cInteger));
      }
  
      // nopTransformer
      //------------------------------------------------------------------
  
      public void testNopTransformer() {
          assertNotNull(TransformerUtils.nullTransformer());
          assertSame(TransformerUtils.nullTransformer(), TransformerUtils.nullTransformer());
          assertEquals(null, TransformerUtils.nopTransformer().transform(null));
          assertEquals(cObject, TransformerUtils.nopTransformer().transform(cObject));
          assertEquals(cString, TransformerUtils.nopTransformer().transform(cString));
          assertEquals(cInteger, TransformerUtils.nopTransformer().transform(cInteger));
      }
  
      // constantTransformer
      //------------------------------------------------------------------
  
      public void testConstantTransformer() {
          assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(null));
          assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cObject));
          assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cString));
          assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cInteger));
      }
  
      // cloneTransformer
      //------------------------------------------------------------------
  
      public void testCloneTransformer() {
          assertEquals(null, TransformerUtils.cloneTransformer().transform(null));
          assertEquals(cString, TransformerUtils.cloneTransformer().transform(cString));
          assertEquals(cInteger, TransformerUtils.cloneTransformer().transform(cInteger));
          try {
              assertEquals(cObject, TransformerUtils.cloneTransformer().transform(cObject));
          } catch (TransformerException ex) {
              return;
          }
          fail();
      }
  
      // mapTransformer
      //------------------------------------------------------------------
  
      public void testMapTransformer() {
          Map map = new HashMap();
          map.put(null, new Integer(0));
          map.put(cObject, new Integer(1));
          map.put(cString, new Integer(2));
          assertEquals(new Integer(0), TransformerUtils.mapTransformer(map).transform(null));
          assertEquals(new Integer(1), TransformerUtils.mapTransformer(map).transform(cObject));
          assertEquals(new Integer(2), TransformerUtils.mapTransformer(map).transform(cString));
          assertEquals(null, TransformerUtils.mapTransformer(map).transform(cInteger));
      }
  
      // commandTransformer
      //------------------------------------------------------------------
  
      public void testCommandTransformer() {
  //        assertEquals(cObject, TransformerUtils.commandTransformer().transform(null));
  //        assertEquals(cObject, TransformerUtils.commandTransformer().transform(cObject));
  //        assertEquals(cObject, TransformerUtils.commandTransformer().transform(cString));
  //        assertEquals(cObject, TransformerUtils.commandTransformer().transform(cInteger));
          try {
              TransformerUtils.commandTransformer(null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
  
      // predicateTransformer
      //------------------------------------------------------------------
  
      public void testPredicateTransformer() {
          assertEquals(Boolean.TRUE, TransformerUtils.predicateTransformer(PredicateUtils.truePredicate()).transform(null));
          assertEquals(Boolean.TRUE, TransformerUtils.predicateTransformer(PredicateUtils.truePredicate()).transform(cObject));
          assertEquals(Boolean.TRUE, TransformerUtils.predicateTransformer(PredicateUtils.truePredicate()).transform(cString));
          assertEquals(Boolean.TRUE, TransformerUtils.predicateTransformer(PredicateUtils.truePredicate()).transform(cInteger));
          try {
              TransformerUtils.predicateTransformer(null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
  
      // factoryTransformer
      //------------------------------------------------------------------
  
      public void testFactoryTransformer() {
          assertEquals(null, TransformerUtils.factoryTransformer(FactoryUtils.nullFactory()).transform(null));
          assertEquals(null, TransformerUtils.factoryTransformer(FactoryUtils.nullFactory()).transform(cObject));
          assertEquals(null, TransformerUtils.factoryTransformer(FactoryUtils.nullFactory()).transform(cString));
          assertEquals(null, TransformerUtils.factoryTransformer(FactoryUtils.nullFactory()).transform(cInteger));
          try {
              TransformerUtils.factoryTransformer(null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
  
      // chainedTransformer
      //------------------------------------------------------------------
  
      public void testChainedTransformer() {
          Transformer a = TransformerUtils.constantTransformer("A");
          Transformer b = TransformerUtils.constantTransformer("B");
          
          assertEquals("A", TransformerUtils.chainedTransformer(b, a).transform(null));
          assertEquals("B", TransformerUtils.chainedTransformer(a, b).transform(null));
          assertEquals("A", TransformerUtils.chainedTransformer(new Transformer[] {b, a}).transform(null));
          Collection coll = new ArrayList();
          coll.add(b);
          coll.add(a);
          assertEquals("A", TransformerUtils.chainedTransformer(coll).transform(null));
      }
  
      public void testChainedTransformerEx1a() {
          try {
              TransformerUtils.chainedTransformer(null, null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx1b() {
          try {
              TransformerUtils.chainedTransformer((Transformer[]) null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx1c() {
          try {
              TransformerUtils.chainedTransformer((Collection) null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx2() {
          try {
              TransformerUtils.chainedTransformer(new Transformer[0]);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx3() {
          try {
              TransformerUtils.chainedTransformer(new Transformer[] {null, null});
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx4() {
          try {
              TransformerUtils.chainedTransformer(Collections.EMPTY_LIST);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testChainedTransformerEx5() {
          try {
              Collection coll = new ArrayList();
              coll.add(null);
              coll.add(null);
              TransformerUtils.chainedTransformer(coll);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      // switchTransformer
      //------------------------------------------------------------------
  
      public void testSwitchTransformer() {
          Transformer a = TransformerUtils.constantTransformer("A");
          Transformer b = TransformerUtils.constantTransformer("B");
          Transformer c = TransformerUtils.constantTransformer("C");
          
          assertEquals("A", TransformerUtils.switchTransformer(PredicateUtils.truePredicate(), a, b).transform(null));
          assertEquals("B", TransformerUtils.switchTransformer(PredicateUtils.falsePredicate(), a, b).transform(null));
          
          assertEquals(null, TransformerUtils.switchTransformer(
              new Predicate[] {PredicateUtils.equalPredicate("HELLO"), PredicateUtils.equalPredicate("THERE")}, 
              new Transformer[] {a, b}).transform("WELL"));
          assertEquals("A", TransformerUtils.switchTransformer(
              new Predicate[] {PredicateUtils.equalPredicate("HELLO"), PredicateUtils.equalPredicate("THERE")}, 
              new Transformer[] {a, b}).transform("HELLO"));
          assertEquals("B", TransformerUtils.switchTransformer(
              new Predicate[] {PredicateUtils.equalPredicate("HELLO"), PredicateUtils.equalPredicate("THERE")}, 
              new Transformer[] {a, b}).transform("THERE"));
              
          assertEquals("C", TransformerUtils.switchTransformer(
              new Predicate[] {PredicateUtils.equalPredicate("HELLO"), PredicateUtils.equalPredicate("THERE")}, 
              new Transformer[] {a, b}, c).transform("WELL"));
              
          Map map = new HashMap();
          map.put(PredicateUtils.equalPredicate("HELLO"), a);
          map.put(PredicateUtils.equalPredicate("THERE"), b);
          assertEquals(null, TransformerUtils.switchTransformer(map).transform("WELL"));
          assertEquals("A", TransformerUtils.switchTransformer(map).transform("HELLO"));
          assertEquals("B", TransformerUtils.switchTransformer(map).transform("THERE"));
          map.put(null, c);
          assertEquals("C", TransformerUtils.switchTransformer(map).transform("WELL"));
      }
  
      public void testSwitchTransformerEx1a() {
          try {
              TransformerUtils.switchTransformer(null, null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx1b() {
          try {
              TransformerUtils.switchTransformer((Predicate[]) null, (Transformer[]) null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx1c() {
          try {
              TransformerUtils.switchTransformer((Map) null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx2() {
          try {
              TransformerUtils.switchTransformer(new Predicate[0], new Transformer[0]);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx3() {
          try {
              TransformerUtils.switchTransformer(new Predicate[2], new Transformer[2]);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx4() {
          try {
              TransformerUtils.switchTransformer(Collections.EMPTY_MAP);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx5() {
          try {
              Map map = new HashMap();
              map.put(null, null);
              map.put(null, null);
              TransformerUtils.switchTransformer(map);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchTransformerEx6() {
          try {
              TransformerUtils.switchTransformer(new Predicate[2], new Transformer[1]);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      // switchMapTransformer
      //------------------------------------------------------------------
  
      public void testSwitchMapTransformer() {
          Transformer a = TransformerUtils.constantTransformer("A");
          Transformer b = TransformerUtils.constantTransformer("B");
          Transformer c = TransformerUtils.constantTransformer("C");
          
          Map map = new HashMap();
          map.put("HELLO", a);
          map.put("THERE", b);
          assertEquals(null, TransformerUtils.switchMapTransformer(map).transform("WELL"));
          assertEquals("A", TransformerUtils.switchMapTransformer(map).transform("HELLO"));
          assertEquals("B", TransformerUtils.switchMapTransformer(map).transform("THERE"));
          map.put(null, c);
          assertEquals("C", TransformerUtils.switchMapTransformer(map).transform("WELL"));
      }
  
      public void testSwitchMapTransformerEx1() {
          try {
              TransformerUtils.switchMapTransformer(null);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      public void testSwitchMapTransformerEx2() {
          try {
              TransformerUtils.switchMapTransformer(Collections.EMPTY_MAP);
          } catch (IllegalArgumentException ex) {
              return;
          }
          fail();
      }
      
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/transformer/TransformerTestSuite.java
  
  Index: TransformerTestSuite.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.pattern.transformer;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  /**
   * Test suite for the Transformer pattern package.
   *
   * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
   * @version $Id: TransformerTestSuite.java,v 1.1 2002/07/20 14:48:26 scolebourne Exp $
   */
  public class TransformerTestSuite extends TestCase {
      
      /**
       * Construct a new instance.
       */
      public TransformerTestSuite(String name) {
          super(name);
      }
  
      /**
       * Command-line interface.
       */
      public static void main(String[] args) {
          TestRunner.run(suite());
      }
  
      /**
       * Get the suite of tests
       */
      public static Test suite() {
          TestSuite suite = new TestSuite();
          suite.addTest(TestTransformerUtils.suite());
          return suite;
      }
  }
  
  
  
  1.2       +319 -70   jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/predicate/TestPredicateUtils.java
  
  Index: TestPredicateUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/predicate/TestPredicateUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPredicateUtils.java	29 Jun 2002 12:51:10 -0000	1.1
  +++ TestPredicateUtils.java	20 Jul 2002 14:48:26 -0000	1.2
  @@ -54,12 +54,16 @@
   package org.apache.commons.pattern.predicate;
   
   import java.io.Serializable;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.Collections;
   import java.util.Date;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
   import org.apache.commons.lang.SerializationException;
  +import org.apache.commons.pattern.transformer.TransformerUtils;
   /**
    * Tests the org.apache.commons.pattern.predicate.PredicateUtils class.
    *
  @@ -98,35 +102,53 @@
       public void tearDown() {
       }
   
  +    // exceptionPredicate
  +    //------------------------------------------------------------------
  +
  +    public void testExceptionPredicate() {
  +        assertNotNull(PredicateUtils.exceptionPredicate());
  +        assertSame(PredicateUtils.exceptionPredicate(), PredicateUtils.exceptionPredicate());
  +        try {
  +            PredicateUtils.exceptionPredicate().evaluate(null);
  +        } catch (PredicateException ex) {
  +            try {
  +                PredicateUtils.exceptionPredicate().evaluate(cString);
  +            } catch (PredicateException ex2) {
  +                return;
  +            }
  +        }
  +        fail();
  +    }
  +    
       // nullPredicate
       //------------------------------------------------------------------
   
       public void testNullPredicate() {
  -        assertNotNull(PredicateUtils.NULL_PREDICATE);
  -        assertSame(PredicateUtils.NULL_PREDICATE, PredicateUtils.nullPredicate());
  -        assertEquals(true, PredicateUtils.NULL_PREDICATE.evaluate(null));
  -        assertEquals(false, PredicateUtils.NULL_PREDICATE.evaluate(cObject));
  -        assertEquals(false, PredicateUtils.NULL_PREDICATE.evaluate(cString));
  -        assertEquals(false, PredicateUtils.NULL_PREDICATE.evaluate(cInteger));
  +        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() {
  -        assertNotNull(PredicateUtils.NOT_NULL_PREDICATE);
  -        assertSame(PredicateUtils.NOT_NULL_PREDICATE, PredicateUtils.notNullPredicate());
  -        assertEquals(false, PredicateUtils.NOT_NULL_PREDICATE.evaluate(null));
  -        assertEquals(true, PredicateUtils.NOT_NULL_PREDICATE.evaluate(cObject));
  -        assertEquals(true, PredicateUtils.NOT_NULL_PREDICATE.evaluate(cString));
  -        assertEquals(true, PredicateUtils.NOT_NULL_PREDICATE.evaluate(cInteger));
  +        assertNotNull(PredicateUtils.notNullPredicate());
  +        assertSame(PredicateUtils.notNullPredicate(), PredicateUtils.notNullPredicate());
  +        assertEquals(false, PredicateUtils.notNullPredicate().evaluate(null));
  +        assertEquals(true, PredicateUtils.notNullPredicate().evaluate(cObject));
  +        assertEquals(true, PredicateUtils.notNullPredicate().evaluate(cString));
  +        assertEquals(true, PredicateUtils.notNullPredicate().evaluate(cInteger));
       }
   
       // equalPredicate
       //------------------------------------------------------------------
   
       public void testEqualPredicate() {
  -        assertSame(PredicateUtils.NULL_PREDICATE, PredicateUtils.equalPredicate(null));
  +        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));
  @@ -138,7 +160,7 @@
       //------------------------------------------------------------------
   
       public void testIdentityPredicate() {
  -        assertSame(PredicateUtils.NULL_PREDICATE, PredicateUtils.identityPredicate(null));
  +        assertSame(PredicateUtils.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));
  @@ -151,35 +173,35 @@
       //------------------------------------------------------------------
   
       public void testTruePredicate() {
  -        assertNotNull(PredicateUtils.TRUE_PREDICATE);
  -        assertSame(PredicateUtils.TRUE_PREDICATE, PredicateUtils.truePredicate());
  -        assertEquals(true, PredicateUtils.TRUE_PREDICATE.evaluate(null));
  -        assertEquals(true, PredicateUtils.TRUE_PREDICATE.evaluate(cObject));
  -        assertEquals(true, PredicateUtils.TRUE_PREDICATE.evaluate(cString));
  -        assertEquals(true, PredicateUtils.TRUE_PREDICATE.evaluate(cInteger));
  +        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));
       }
   
       // falsePredicate
       //------------------------------------------------------------------
   
       public void testFalsePredicate() {
  -        assertNotNull(PredicateUtils.FALSE_PREDICATE);
  -        assertSame(PredicateUtils.FALSE_PREDICATE, PredicateUtils.falsePredicate());
  -        assertEquals(false, PredicateUtils.FALSE_PREDICATE.evaluate(null));
  -        assertEquals(false, PredicateUtils.FALSE_PREDICATE.evaluate(cObject));
  -        assertEquals(false, PredicateUtils.FALSE_PREDICATE.evaluate(cString));
  -        assertEquals(false, PredicateUtils.FALSE_PREDICATE.evaluate(cInteger));
  +        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));
       }
   
       // notPredicate
       //------------------------------------------------------------------
   
       public void testNotPredicate() {
  -        assertNotNull(PredicateUtils.notPredicate(PredicateUtils.TRUE_PREDICATE));
  -        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.TRUE_PREDICATE).evaluate(cObject));
  -        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.TRUE_PREDICATE).evaluate(cString));
  -        assertEquals(false, PredicateUtils.notPredicate(PredicateUtils.TRUE_PREDICATE).evaluate(cInteger));
  +        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));
       }
       
       public void testNotPredicateEx() {
  @@ -195,10 +217,10 @@
       //------------------------------------------------------------------
   
       public void testAndPredicate() {
  -        assertEquals(true, PredicateUtils.andPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.andPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  +        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));
       }
   
       public void testAndPredicateEx() {
  @@ -215,18 +237,38 @@
   
       public void testAllPredicate() {
           assertEquals(true, PredicateUtils.allPredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.allPredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            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));
  +        coll.clear();
  +        coll.add(PredicateUtils.truePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(false, PredicateUtils.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.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        assertEquals(false, PredicateUtils.allPredicate(coll).evaluate(null));
       }
   
       public void testAllPredicateEx1() {
           try {
  -            PredicateUtils.allPredicate(null);
  +            PredicateUtils.allPredicate((Predicate[]) null);
           } catch (IllegalArgumentException ex) {
               return;
           }
  @@ -251,14 +293,44 @@
           fail();
       }
       
  +    public void testAllPredicateEx4() {
  +        try {
  +            PredicateUtils.allPredicate((Collection) null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testAllPredicateEx5() {
  +        try {
  +            PredicateUtils.allPredicate(Collections.EMPTY_LIST);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testAllPredicateEx6() {
  +        try {
  +            Collection coll = new ArrayList();
  +            coll.add(null);
  +            coll.add(null);
  +            PredicateUtils.allPredicate(coll);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
       // orPredicate
       //------------------------------------------------------------------
   
       public void testOrPredicate() {
  -        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  -        assertEquals(true, PredicateUtils.orPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.orPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  +        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));
       }
       
       public void testOrPredicateEx() {
  @@ -275,18 +347,38 @@
   
       public void testAnyPredicate() {
           assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.anyPredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.anyPredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            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.anyPredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.truePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(true, PredicateUtils.anyPredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        assertEquals(false, PredicateUtils.anyPredicate(coll).evaluate(null));
       }
   
       public void testAnyPredicateEx1() {
           try {
  -            PredicateUtils.anyPredicate(null);
  +            PredicateUtils.anyPredicate((Predicate[]) null);
           } catch (IllegalArgumentException ex) {
               return;
           }
  @@ -311,14 +403,44 @@
           fail();
       }
       
  +    public void testAnyPredicateEx4() {
  +        try {
  +            PredicateUtils.anyPredicate((Collection) null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testAnyPredicateEx5() {
  +        try {
  +            PredicateUtils.anyPredicate(Collections.EMPTY_LIST);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testAnyPredicateEx6() {
  +        try {
  +            Collection coll = new ArrayList();
  +            coll.add(null);
  +            coll.add(null);
  +            PredicateUtils.anyPredicate(coll);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
       // eitherPredicate
       //------------------------------------------------------------------
   
       public void testEitherPredicate() {
  -        assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  -        assertEquals(true, PredicateUtils.eitherPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.eitherPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  +        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));
       }
   
       public void testEitherPredicateEx() {
  @@ -335,22 +457,42 @@
   
       public void testOnePredicate() {
           assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            PredicateUtils.falsePredicate(), PredicateUtils.truePredicate(), PredicateUtils.falsePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.onePredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            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(false, PredicateUtils.onePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.truePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(true, PredicateUtils.onePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        assertEquals(false, PredicateUtils.onePredicate(coll).evaluate(null));
       }
   
       public void testOnePredicateEx1() {
           try {
  -            PredicateUtils.onePredicate(null);
  +            PredicateUtils.onePredicate((Predicate[]) null);
           } catch (IllegalArgumentException ex) {
               return;
           }
  @@ -375,14 +517,44 @@
           fail();
       }
       
  +    public void testOnePredicateEx4() {
  +        try {
  +            PredicateUtils.onePredicate((Collection) null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testOnePredicateEx5() {
  +        try {
  +            PredicateUtils.onePredicate(Collections.EMPTY_LIST);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testOnePredicateEx6() {
  +        try {
  +            Collection coll = new ArrayList();
  +            coll.add(null);
  +            coll.add(null);
  +            PredicateUtils.onePredicate(coll);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
       // neitherPredicate
       //------------------------------------------------------------------
   
       public void testNeitherPredicate() {
  -        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  -        assertEquals(false, PredicateUtils.neitherPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE).evaluate(null));
  -        assertEquals(true, PredicateUtils.neitherPredicate(PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE).evaluate(null));
  +        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));
       }
   
       public void testNeitherPredicateEx() {
  @@ -399,18 +571,38 @@
   
       public void testNonePredicate() {
           assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
  -            PredicateUtils.TRUE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.TRUE_PREDICATE}).evaluate(null));
  +            PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null));
           assertEquals(true, PredicateUtils.nonePredicate(new Predicate[] {
  -            PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE, PredicateUtils.FALSE_PREDICATE}).evaluate(null));
  +            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(false, PredicateUtils.nonePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.truePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.truePredicate());
  +        assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null));
  +        coll.clear();
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        coll.add(PredicateUtils.falsePredicate());
  +        assertEquals(true, PredicateUtils.nonePredicate(coll).evaluate(null));
       }
   
       public void testNonePredicateEx1() {
           try {
  -            PredicateUtils.nonePredicate(null);
  +            PredicateUtils.nonePredicate((Predicate[]) null);
           } catch (IllegalArgumentException ex) {
               return;
           }
  @@ -435,6 +627,36 @@
           fail();
       }
       
  +    public void testNonePredicateEx4() {
  +        try {
  +            PredicateUtils.nonePredicate((Collection) null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testNonePredicateEx5() {
  +        try {
  +            PredicateUtils.nonePredicate(Collections.EMPTY_LIST);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testNonePredicateEx6() {
  +        try {
  +            Collection coll = new ArrayList();
  +            coll.add(null);
  +            coll.add(null);
  +            PredicateUtils.nonePredicate(coll);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
       // instanceofPredicate
       //------------------------------------------------------------------
   
  @@ -458,4 +680,31 @@
           assertEquals(false, p.evaluate(cString));
           assertEquals(false, p.evaluate(cString));
       }
  +    
  +    // transformerPredicate
  +    //------------------------------------------------------------------
  +
  +    public void testTransformerPredicate() {
  +        assertEquals(false, PredicateUtils.transformerPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.FALSE));
  +        assertEquals(true, PredicateUtils.transformerPredicate(TransformerUtils.nopTransformer()).evaluate(Boolean.TRUE));
  +    }
  +
  +    public void testTransformerPredicateEx1() {
  +        try {
  +            PredicateUtils.transformerPredicate(null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
  +    public void testTransformerPredicateEx2() {
  +        try {
  +            PredicateUtils.transformerPredicate(TransformerUtils.nopTransformer()).evaluate(null);
  +        } catch (PredicateException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message