You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2002/08/10 01:11:35 UTC

cvs commit: jakarta-commons-sandbox/pattern/src/test/org/apache/commons/pattern/predicate TestPredicateUtils.java

scolebourne    2002/08/09 16:11:35

  Modified:    pattern/src/test/org/apache/commons/pattern/predicate
                        TestPredicateUtils.java
  Log:
  Test three new decorators, from Ola Berg
  
  Revision  Changes    Path
  1.3       +59 -1     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPredicateUtils.java	20 Jul 2002 14:48:26 -0000	1.2
  +++ TestPredicateUtils.java	9 Aug 2002 23:11:35 -0000	1.3
  @@ -707,4 +707,62 @@
           fail();
       }
       
  +    // nullIsException
  +    //------------------------------------------------------------------
  +
  +    public void testNullIsExceptionPredicate() {
  +        assertEquals(true, PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(new Object()));
  +        try {
  +            PredicateUtils.nullIsExceptionPredicate(PredicateUtils.truePredicate()).evaluate(null);
  +        } catch (PredicateException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +
  +    public void testNullIsExceptionPredicateEx1() {
  +        try {
  +            PredicateUtils.nullIsExceptionPredicate(null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        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()));
  +    }
  +
  +    public void testNullIsTruePredicateEx1() {
  +        try {
  +            PredicateUtils.nullIsTruePredicate(null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        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()));
  +    }
  +
  +    public void testNullIsFalsePredicateEx1() {
  +        try {
  +            PredicateUtils.nullIsFalsePredicate(null);
  +        } catch (IllegalArgumentException ex) {
  +            return;
  +        }
  +        fail();
  +    }
  +    
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>