rwaldhoff    2003/12/02 17:07:36

  Modified:    functor/src/test/org/apache/commons/functor/core/composite
                        TestCompositeUnaryProcedure.java
                        TestCompositeUnaryPredicate.java
               functor/src/java/org/apache/commons/functor/core/composite
                        CompositeUnaryProcedure.java
                        CompositeUnaryPredicate.java
  Log:
  add tests, remove unused
  
  Revision  Changes    Path
  1.2       +16 -2     
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java
  
  Index: TestCompositeUnaryProcedure.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestCompositeUnaryProcedure.java  3 Dec 2003 01:04:11 -0000       1.1
  +++ TestCompositeUnaryProcedure.java  3 Dec 2003 01:07:36 -0000       1.2
  @@ -106,6 +106,20 @@
           new CompositeUnaryProcedure(new NoOp(),new Identity()).run(null);
       }
       
  +    public void testNullNotAllowed() throws Exception {
  +        try {
  +            new CompositeUnaryProcedure(null);
  +            fail("Expected NullPointerException");
  +        } catch(NullPointerException e) {
  +            // expected
  +        }
  +        try {
  +            new CompositeUnaryProcedure(NoOp.instance(),null);
  +            fail("Expected NullPointerException");
  +        } catch(NullPointerException e) {
  +            // expected
  +        }
  +    }
       public void testOf() throws Exception {
           new CompositeUnaryProcedure(new NoOp()).of(new Identity()).run(null);
       }
  
  
  
  1.2       +20 -6     
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java
  
  Index: TestCompositeUnaryPredicate.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestCompositeUnaryPredicate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestCompositeUnaryPredicate.java  3 Dec 2003 01:04:11 -0000       1.1
  +++ TestCompositeUnaryPredicate.java  3 Dec 2003 01:07:36 -0000       1.2
  @@ -101,13 +101,27 @@
       // Tests
       // ------------------------------------------------------------------------
       
  -    public void testEvaluate() throws Exception {
  -        assertEquals(true,(new CompositeUnaryPredicate(new 
Constant(true))).test(null));
  -        
  +    public void testTest() throws Exception {
  +        assertEquals(true,(new CompositeUnaryPredicate(new 
Constant(true))).test(null));        
           assertEquals(true,(new CompositeUnaryPredicate(new Constant(true),new 
Constant(new Integer(3)))).test("xyzzy"));
           assertEquals(false,(new CompositeUnaryPredicate(new Constant(false),new 
Constant(new Integer(4)))).test("xyzzy"));
       }
  -    
  +
  +    public void testNullNotAllowed() throws Exception {
  +        try {
  +            new CompositeUnaryPredicate(null);
  +            fail("Expected NullPointerException");
  +        } catch(NullPointerException e) {
  +            // expected
  +        }
  +        try {
  +            new CompositeUnaryPredicate(Constant.truePredicate(),null);
  +            fail("Expected NullPointerException");
  +        } catch(NullPointerException e) {
  +            // expected
  +        }
  +    }
  +        
       public void testOf() throws Exception {
           CompositeUnaryPredicate f = new CompositeUnaryPredicate(new Constant(true));
           assertTrue(f.test(null));
  
  
  
  1.2       +2 -10     
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java
  
  Index: CompositeUnaryProcedure.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryProcedure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompositeUnaryProcedure.java      3 Dec 2003 01:04:12 -0000       1.1
  +++ CompositeUnaryProcedure.java      3 Dec 2003 01:07:36 -0000       1.2
  @@ -101,14 +101,6 @@
           this.function = new CompositeUnaryFunction(f);
       }
   
  -    public CompositeUnaryProcedure(UnaryProcedure p, UnaryFunction f, UnaryFunction 
g) {
  -        if(null == p) { throw new NullPointerException(); }
  -        if(null == f) { throw new NullPointerException(); }
  -        if(null == g) { throw new NullPointerException(); }
  -        this.procedure = p;
  -        this.function = new CompositeUnaryFunction(f).of(g);
  -    }
  -
       // modifiers
       // ------------------------------------------------------------------------ 
       public CompositeUnaryProcedure of(UnaryFunction f) {
  
  
  
  1.2       +2 -10     
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java
  
  Index: CompositeUnaryPredicate.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/composite/CompositeUnaryPredicate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompositeUnaryPredicate.java      3 Dec 2003 01:04:12 -0000       1.1
  +++ CompositeUnaryPredicate.java      3 Dec 2003 01:07:36 -0000       1.2
  @@ -101,14 +101,6 @@
           this.function = new CompositeUnaryFunction(f);
       }
   
  -    public CompositeUnaryPredicate(UnaryPredicate p, UnaryFunction f, UnaryFunction 
g) {
  -        if(null == p) { throw new NullPointerException(); }
  -        if(null == f) { throw new NullPointerException(); }
  -        if(null == g) { throw new NullPointerException(); }
  -        this.predicate = p;
  -        this.function = new CompositeUnaryFunction(f).of(g);
  -    }
  -
       // modifiers
       // ------------------------------------------------------------------------ 
       public CompositeUnaryPredicate of(UnaryFunction f) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to