commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject svn commit: r1508677 [6/9] - in /commons/proper/functor/trunk: api/src/main/java/org/apache/commons/functor/ core/src/main/java/org/apache/commons/functor/adapter/ core/src/main/java/org/apache/commons/functor/aggregator/ core/src/main/java/org/apache/...
Date Tue, 30 Jul 2013 22:48:08 GMT
Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryFunctionFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryFunctionFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryFunctionFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryFunctionFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.*;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Function;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.IsNotSame;
+import org.apache.commons.functor.core.IsSame;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1345136 $ $Date: 2012-06-01 09:47:06 -0300 (Fri, 01 Jun 2012) $
+ */
+public class TestBinaryFunctionFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BinaryFunctionFunction<Object, Object>(BinaryPredicateBinaryFunction.adapt(IsSame.INSTANCE));
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTestWhenTrue() throws Exception {
+        Function<Object, Boolean> f = new BinaryFunctionFunction<Object, Boolean>(BinaryPredicateBinaryFunction.adapt(IsSame.INSTANCE));
+        assertEquals(Boolean.TRUE, f.evaluate(null));
+    }
+
+    @Test
+    public void testTestWhenFalse() throws Exception {
+        Function<Object, Boolean> f = new BinaryFunctionFunction<Object, Boolean>(BinaryPredicateBinaryFunction.adapt(IsNotSame.INSTANCE));
+        assertEquals(Boolean.FALSE, f.evaluate(null));
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Function<Object, Boolean> f = new BinaryFunctionFunction<Object, Boolean>(BinaryPredicateBinaryFunction.adapt(IsSame.INSTANCE));
+        assertEquals(f, f);
+        assertObjectsAreEqual(f, new BinaryFunctionFunction<Object, Boolean>(BinaryPredicateBinaryFunction.adapt(IsSame.INSTANCE)));
+        assertObjectsAreNotEqual(f, Constant.truePredicate());
+        assertObjectsAreNotEqual(f, new BinaryFunctionFunction<Object, Boolean>(BinaryPredicateBinaryFunction.adapt(IsNotSame.INSTANCE)));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BinaryFunctionFunction.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BinaryFunctionFunction.adapt(Constant.TRUE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicatePredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicatePredicate.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicatePredicate.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicatePredicate.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Predicate;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.IsNotSame;
+import org.apache.commons.functor.core.IsSame;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1345136 $ $Date: 2012-06-01 09:47:06 -0300 (Fri, 01 Jun 2012) $
+ */
+public class TestBinaryPredicatePredicate extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BinaryPredicatePredicate<Object>(IsSame.INSTANCE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTestWhenTrue() throws Exception {
+        Predicate<Object> p = new BinaryPredicatePredicate<Object>(IsSame.INSTANCE);
+        assertTrue(p.test(null));
+    }
+
+    @Test
+    public void testTestWhenFalse() throws Exception {
+        Predicate<Object> p = new BinaryPredicatePredicate<Object>(IsNotSame.INSTANCE);
+        assertFalse(p.test(null));
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Predicate<Object> p = new BinaryPredicatePredicate<Object>(IsSame.INSTANCE);
+        assertEquals(p, p);
+        assertObjectsAreEqual(p, new BinaryPredicatePredicate<Object>(IsSame.INSTANCE));
+        assertObjectsAreNotEqual(p, Constant.truePredicate());
+        assertObjectsAreNotEqual(p, new BinaryPredicatePredicate<Object>(IsNotSame.INSTANCE));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BinaryPredicatePredicate.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BinaryPredicatePredicate.adapt(Constant.TRUE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryProcedureProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryProcedureProcedure.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryProcedureProcedure.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBinaryProcedureProcedure.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Procedure;
+import org.apache.commons.functor.core.NoOp;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestBinaryProcedureProcedure extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BinaryProcedureProcedure<Object>(NoOp.INSTANCE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testRun() throws Exception {
+        Procedure<Object> p = new BinaryProcedureProcedure<Object>(NoOp.INSTANCE);
+        p.run(null);
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Procedure<Object> p = new BinaryProcedureProcedure<Object>(NoOp.INSTANCE);
+        assertEquals(p, p);
+        assertObjectsAreEqual(p, new BinaryProcedureProcedure<Object>(NoOp.INSTANCE));
+        assertObjectsAreNotEqual(p, NoOp.INSTANCE);
+        assertObjectsAreNotEqual(p, new BinaryProcedureProcedure<Object>(IgnoreLeftProcedure.adapt(NoOp.INSTANCE)));
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BinaryProcedureProcedure.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BinaryProcedureProcedure.adapt(NoOp.INSTANCE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryFunction;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.Identity;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestBoundNullaryFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BoundNullaryFunction<Object>(Identity.INSTANCE,"xyzzy");
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        NullaryFunction<Object> f = new BoundNullaryFunction<Object>(Identity.INSTANCE,"xyzzy");
+        assertEquals("xyzzy",f.evaluate());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryFunction<Object> f = new BoundNullaryFunction<Object>(Identity.INSTANCE,"xyzzy");
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new BoundNullaryFunction<Object>(Identity.INSTANCE,"xyzzy"));
+        assertObjectsAreNotEqual(f,Constant.of("xyzzy"));
+        assertObjectsAreNotEqual(f,new BoundNullaryFunction<Object>(Identity.INSTANCE,"foo"));
+        assertObjectsAreNotEqual(f,new BoundNullaryFunction<Object>(Constant.of("xyzzy"),"foo"));
+        assertObjectsAreNotEqual(f,new BoundNullaryFunction<Object>(Identity.INSTANCE,null));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BoundNullaryFunction.bind(null,"xyzzy"));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BoundNullaryFunction.bind(Identity.INSTANCE,"xyzzy"));
+        assertNotNull(BoundNullaryFunction.bind(Identity.INSTANCE,null));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryPredicate.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryPredicate.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryPredicate.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryPredicate;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.Identity;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestBoundNullaryPredicate extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BoundNullaryPredicate(Constant.TRUE,"xyzzy");
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTest() throws Exception {
+        {
+            NullaryPredicate p = new BoundNullaryPredicate(new FunctionPredicate<Boolean>(Identity.<Boolean>instance()),Boolean.TRUE);
+            assertTrue(p.test());
+        }
+        {
+            NullaryPredicate p = new BoundNullaryPredicate(new FunctionPredicate<Boolean>(Identity.<Boolean>instance()),Boolean.FALSE);
+            assertFalse(p.test());
+        }
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryPredicate f = new BoundNullaryPredicate(Constant.TRUE,"xyzzy");
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new BoundNullaryPredicate(Constant.TRUE,"xyzzy"));
+        assertObjectsAreNotEqual(f,Constant.TRUE);
+        assertObjectsAreNotEqual(f,new BoundNullaryPredicate(Constant.TRUE,"foo"));
+        assertObjectsAreNotEqual(f,new BoundNullaryPredicate(Constant.FALSE,"xyzzy"));
+        assertObjectsAreNotEqual(f,new BoundNullaryPredicate(Constant.TRUE,null));
+        assertObjectsAreEqual(new BoundNullaryPredicate(Constant.TRUE,null),new BoundNullaryPredicate(Constant.TRUE,null));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BoundNullaryPredicate.bind(null,"xyzzy"));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BoundNullaryPredicate.bind(Constant.TRUE,"xyzzy"));
+        assertNotNull(BoundNullaryPredicate.bind(Constant.TRUE,null));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryProcedure.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryProcedure.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestBoundNullaryProcedure.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryProcedure;
+import org.apache.commons.functor.core.Identity;
+import org.apache.commons.functor.core.NoOp;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestBoundNullaryProcedure extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new BoundNullaryProcedure(NoOp.INSTANCE,"xyzzy");
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testRun() throws Exception {
+        NullaryProcedure p = new BoundNullaryProcedure(new FunctionProcedure<Object>(Identity.INSTANCE),Boolean.TRUE);
+        p.run();
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryProcedure f = new BoundNullaryProcedure(NoOp.INSTANCE,"xyzzy");
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new BoundNullaryProcedure(NoOp.INSTANCE,"xyzzy"));
+        assertObjectsAreNotEqual(f,NoOp.INSTANCE);
+        assertObjectsAreNotEqual(f,new BoundNullaryProcedure(NoOp.INSTANCE,"foo"));
+        assertObjectsAreNotEqual(f,new BoundNullaryProcedure(new FunctionProcedure<Object>(Identity.INSTANCE),"xyzzy"));
+        assertObjectsAreNotEqual(f,new BoundNullaryProcedure(NoOp.INSTANCE,null));
+        assertObjectsAreEqual(new BoundNullaryProcedure(NoOp.INSTANCE,null),new BoundNullaryProcedure(NoOp.INSTANCE,null));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(BoundNullaryProcedure.bind(null,"xyzzy"));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(BoundNullaryProcedure.bind(new NoOp(),"xyzzy"));
+        assertNotNull(BoundNullaryProcedure.bind(new NoOp(),null));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryFunction;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.LeftIdentity;
+import org.apache.commons.functor.core.RightIdentity;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestFullyBoundNullaryFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "xyzzy");
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        NullaryFunction<Object> f = new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "foo");
+        assertEquals("foo", f.evaluate());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryFunction<Object> f = new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "xyzzy");
+        assertEquals(f, f);
+        assertObjectsAreEqual(f, new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "xyzzy"));
+        assertObjectsAreEqual(new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", "xyzzy"),
+                              new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", "xyzzy"));
+        assertObjectsAreEqual(new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", null),
+                              new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", null));
+        assertObjectsAreNotEqual(f, Constant.of("xyzzy"));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryFunction<Object>(LeftIdentity.FUNCTION, null, "xyzzy"));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", "xyzzy"));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "bar"));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, null));
+        assertObjectsAreNotEqual(new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "xyzzy", "bar"), new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, null, "bar"));
+        assertObjectsAreNotEqual(new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "xyzzy", "bar"), new FullyBoundNullaryFunction<Object>(RightIdentity.FUNCTION, "bar", "bar"));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(FullyBoundNullaryFunction.bind(null, null, "xyzzy"));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(FullyBoundNullaryFunction.bind(RightIdentity.FUNCTION, "xyzzy", "foobar"));
+        assertNotNull(FullyBoundNullaryFunction.bind(RightIdentity.FUNCTION, null, null));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryPredicate.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryPredicate.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryPredicate.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryPredicate;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.RightIdentity;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestFullyBoundNullaryPredicate extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new FullyBoundNullaryPredicate(Constant.TRUE, null, "xyzzy");
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTest() throws Exception {
+        NullaryPredicate p = new FullyBoundNullaryPredicate(
+                new BinaryFunctionBinaryPredicate<Object, Boolean>(RightIdentity.<Object, Boolean> function()), "foo",
+                Boolean.TRUE);
+        assertTrue(p.test());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryPredicate p = new FullyBoundNullaryPredicate(Constant.TRUE, "xyzzy", null);
+        assertEquals(p, p);
+        assertObjectsAreEqual(p, new FullyBoundNullaryPredicate(Constant.TRUE, "xyzzy", null));
+        assertObjectsAreNotEqual(p, Constant.TRUE);
+        assertObjectsAreNotEqual(p, new FullyBoundNullaryPredicate(Constant.FALSE, "xyzzy", null));
+        assertObjectsAreNotEqual(p, new FullyBoundNullaryPredicate(Constant.TRUE, "foo", null));
+        assertObjectsAreNotEqual(p, new FullyBoundNullaryPredicate(Constant.TRUE, null, "xyzzy"));
+        assertObjectsAreNotEqual(new FullyBoundNullaryPredicate(Constant.TRUE, null, "xyzzy"), new FullyBoundNullaryPredicate(Constant.TRUE, null, null));
+        assertObjectsAreEqual(new FullyBoundNullaryPredicate(Constant.TRUE, "foo", "xyzzy"), new FullyBoundNullaryPredicate(Constant.TRUE, "foo", "xyzzy"));
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(FullyBoundNullaryPredicate.bind(null, "xyzzy", null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(FullyBoundNullaryPredicate.bind(Constant.FALSE, "xyzzy", "foobar"));
+        assertNotNull(FullyBoundNullaryPredicate.bind(Constant.FALSE, null, null));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryProcedure.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryProcedure.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFullyBoundNullaryProcedure.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryProcedure;
+import org.apache.commons.functor.core.NoOp;
+import org.apache.commons.functor.core.RightIdentity;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestFullyBoundNullaryProcedure extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", null);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testRun() throws Exception {
+        NullaryProcedure p = new FullyBoundNullaryProcedure(new BinaryFunctionBinaryProcedure<Object, Object>(
+                RightIdentity.FUNCTION), "foo", null);
+        p.run();
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryProcedure f = new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", null);
+        assertEquals(f, f);
+        assertObjectsAreEqual(f, new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", null));
+        assertObjectsAreNotEqual(f, new NoOp());
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryProcedure(
+                new BinaryFunctionBinaryProcedure<Object, Object>(RightIdentity.FUNCTION), "xyzzy", null));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryProcedure(NoOp.INSTANCE, "foo", null));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", "yzzyx"));
+        assertObjectsAreNotEqual(new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", "yzzyx"), new FullyBoundNullaryProcedure(NoOp.INSTANCE, "xyzzy", null));
+        assertObjectsAreNotEqual(f, new FullyBoundNullaryProcedure(NoOp.INSTANCE, null, null));
+        assertObjectsAreEqual(new FullyBoundNullaryProcedure(NoOp.INSTANCE, null, null), new FullyBoundNullaryProcedure(NoOp.INSTANCE, null, null));
+        assertObjectsAreEqual(new FullyBoundNullaryProcedure(NoOp.INSTANCE, "foo", null), new FullyBoundNullaryProcedure(NoOp.INSTANCE, "foo", null));
+        assertObjectsAreEqual(new FullyBoundNullaryProcedure(NoOp.INSTANCE, "foo", "xyzzy"), new FullyBoundNullaryProcedure(NoOp.INSTANCE, "foo", "xyzzy"));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(FullyBoundNullaryProcedure.bind(null, "xyzzy", null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(FullyBoundNullaryProcedure.bind(new NoOp(), "xyzzy", "foobar"));
+        assertNotNull(FullyBoundNullaryProcedure.bind(new NoOp(), null, null));
+    }
+}

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionPredicate.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionPredicate.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionPredicate.java Tue Jul 30 22:48:02 2013
@@ -36,7 +36,7 @@ public class TestFunctionPredicate exten
 
     @Override
     protected Object makeFunctor() {
-        return new FunctionPredicate(Constant.TRUE);
+        return new FunctionPredicate<Object>(Constant.TRUE);
     }
 
     // Tests
@@ -44,23 +44,23 @@ public class TestFunctionPredicate exten
 
     @Test
     public void testTestWhenTrue() throws Exception {
-        Predicate p = new FunctionPredicate(Constant.TRUE);
-        assertTrue(p.test());
+        Predicate<Object> p = new FunctionPredicate<Object>(Constant.TRUE);
+        assertTrue(p.test(null));
     }
 
     @Test
     public void testTestWhenFalse() throws Exception {
-        Predicate p = new FunctionPredicate(Constant.FALSE);
-        assertTrue(!p.test());
+        Predicate<Object> p = new FunctionPredicate<Object>(Constant.FALSE);
+        assertTrue(!p.test(null));
     }
 
     @Test
     public void testEquals() throws Exception {
-        Predicate p = new FunctionPredicate(Constant.TRUE);
+        Predicate<Object> p = new FunctionPredicate<Object>(Constant.TRUE);
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new FunctionPredicate(Constant.TRUE));
+        assertObjectsAreEqual(p,new FunctionPredicate<Object>(Constant.TRUE));
         assertObjectsAreNotEqual(p,Constant.TRUE);
-        assertObjectsAreNotEqual(p,new FunctionPredicate(Constant.FALSE));
+        assertObjectsAreNotEqual(p,new FunctionPredicate<Object>(Constant.FALSE));
         assertTrue(!p.equals(null));
     }
 

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionProcedure.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionProcedure.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestFunctionProcedure.java Tue Jul 30 22:48:02 2013
@@ -38,7 +38,7 @@ public class TestFunctionProcedure exten
 
     @Override
     protected Object makeFunctor() {
-        return new FunctionProcedure(Constant.of("K"));
+        return new FunctionProcedure<Object>(Constant.of("K"));
     }
 
     // Tests
@@ -46,26 +46,26 @@ public class TestFunctionProcedure exten
 
     @Test
     public void testRun() throws Exception {
-        class EvaluateCounter implements Function<Integer> {
+        class EvaluateCounter implements Function<Object, Integer> {
             int count = 0;
-            public Integer evaluate() { return Integer.valueOf(count++); }
+            public Integer evaluate(Object a) { return Integer.valueOf(count++); }
         }
         EvaluateCounter counter = new EvaluateCounter();
-        Procedure p = new FunctionProcedure(counter);
+        Procedure<Object> p = new FunctionProcedure<Object>(counter);
         assertEquals(0,counter.count);
-        p.run();
+        p.run(null);
         assertEquals(1,counter.count);
-        p.run();
+        p.run("x");
         assertEquals(2,counter.count);
     }
 
     @Test
     public void testEquals() throws Exception {
-        Procedure p = new FunctionProcedure(Constant.of("K"));
+        Procedure<Object> p = new FunctionProcedure<Object>(Constant.of("K"));
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new FunctionProcedure(Constant.of("K")));
+        assertObjectsAreEqual(p,new FunctionProcedure<Object>(Constant.of("K")));
         assertObjectsAreNotEqual(p,NoOp.INSTANCE);
-        assertObjectsAreNotEqual(p,new FunctionProcedure(Constant.of("J")));
+        assertObjectsAreNotEqual(p,new FunctionProcedure<Object>(Constant.of("J")));
         assertTrue(!p.equals(null));
     }
 

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java Tue Jul 30 22:48:02 2013
@@ -46,7 +46,7 @@ public class TestIgnoreLeftPredicate ext
     @Test
     public void testEvaluate() throws Exception {
         BinaryPredicate<Object, Boolean> p = new IgnoreLeftPredicate<Object, Boolean>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance()));
         assertTrue(p.test(null,Boolean.TRUE));
         assertTrue(!p.test(null,Boolean.FALSE));
     }
@@ -54,10 +54,10 @@ public class TestIgnoreLeftPredicate ext
     @Test
     public void testEquals() throws Exception {
         BinaryPredicate<Object, Boolean> p = new IgnoreLeftPredicate<Object, Boolean>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance()));
         assertEquals(p,p);
         assertObjectsAreEqual(p,new IgnoreLeftPredicate<Object, Boolean>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance())));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance())));
         assertObjectsAreNotEqual(p,Constant.TRUE);
         assertObjectsAreNotEqual(p,new IgnoreLeftPredicate<Object, Object>(Constant.FALSE));
         assertObjectsAreNotEqual(p,Constant.FALSE);

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftProcedure.java Tue Jul 30 22:48:02 2013
@@ -25,7 +25,7 @@ import org.apache.commons.functor.BaseFu
 import org.apache.commons.functor.BinaryProcedure;
 import org.apache.commons.functor.core.Identity;
 import org.apache.commons.functor.core.NoOp;
-import org.apache.commons.functor.core.composite.UnarySequence;
+import org.apache.commons.functor.core.composite.Sequence;
 import org.junit.Test;
 
 /**
@@ -47,7 +47,7 @@ public class TestIgnoreLeftProcedure ext
     @Test
     public void testEvaluate() throws Exception {
         BinaryProcedure<Object, Object> p = new IgnoreLeftProcedure<Object, Object>(
-                new UnaryFunctionUnaryProcedure<Object>(Identity.INSTANCE));
+                new FunctionProcedure<Object>(Identity.INSTANCE));
         p.run(null,Boolean.TRUE);
     }
 
@@ -57,7 +57,7 @@ public class TestIgnoreLeftProcedure ext
         assertEquals(p,p);
         assertObjectsAreEqual(p,new IgnoreLeftProcedure<Object, Object>(NoOp.INSTANCE));
         assertObjectsAreNotEqual(p,NoOp.INSTANCE);
-        assertObjectsAreNotEqual(p,new IgnoreLeftProcedure<Object, Object>(new UnarySequence<Object>()));
+        assertObjectsAreNotEqual(p,new IgnoreLeftProcedure<Object, Object>(new Sequence<Object>()));
         assertTrue(!p.equals(null));
     }
 

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java Tue Jul 30 22:48:02 2013
@@ -46,7 +46,7 @@ public class TestIgnoreRightPredicate ex
     @Test
     public void testEvaluate() throws Exception {
         BinaryPredicate<Boolean, Object> p = new IgnoreRightPredicate<Boolean, Object>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance()));
         assertTrue(p.test(Boolean.TRUE,null));
         assertTrue(!p.test(Boolean.FALSE,null));
     }
@@ -54,10 +54,10 @@ public class TestIgnoreRightPredicate ex
     @Test
     public void testEquals() throws Exception {
         BinaryPredicate<Boolean, Object> p = new IgnoreRightPredicate<Boolean, Object>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance()));
         assertEquals(p,p);
         assertObjectsAreEqual(p,new IgnoreRightPredicate<Boolean, Object>(
-                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance())));
+                new FunctionPredicate<Boolean>(Identity.<Boolean> instance())));
         assertObjectsAreNotEqual(p,Constant.TRUE);
         assertObjectsAreNotEqual(p,new IgnoreRightPredicate<Boolean, Object>(Constant.FALSE));
         assertObjectsAreNotEqual(p,Constant.FALSE);

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightProcedure.java Tue Jul 30 22:48:02 2013
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTru
 
 import org.apache.commons.functor.BaseFunctorTest;
 import org.apache.commons.functor.BinaryProcedure;
-import org.apache.commons.functor.UnaryProcedure;
+import org.apache.commons.functor.Procedure;
 import org.apache.commons.functor.core.Identity;
 import org.apache.commons.functor.core.NoOp;
 import org.junit.Test;
@@ -47,7 +47,7 @@ public class TestIgnoreRightProcedure ex
     @Test
     public void testEvaluate() throws Exception {
         BinaryProcedure<Object, Object> p = new IgnoreRightProcedure<Object, Object>(
-                new UnaryFunctionUnaryProcedure<Object>(Identity.INSTANCE));
+                new FunctionProcedure<Object>(Identity.INSTANCE));
         p.run(Boolean.TRUE,null);
     }
 
@@ -57,7 +57,7 @@ public class TestIgnoreRightProcedure ex
         assertEquals(p,p);
         assertObjectsAreEqual(p,new IgnoreRightProcedure<Object, Object>(NoOp.INSTANCE));
         assertObjectsAreNotEqual(p,NoOp.INSTANCE);
-        assertObjectsAreNotEqual(p,new IgnoreRightProcedure<Object, Object>(new UnaryProcedure<Object>() {
+        assertObjectsAreNotEqual(p,new IgnoreRightProcedure<Object, Object>(new Procedure<Object>() {
             public void run(Object obj) {
                 // Do nothing
             }

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundFunction.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundFunction.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundFunction.java Tue Jul 30 22:48:02 2013
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryFunction;
+import org.apache.commons.functor.Function;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.LeftIdentity;
 import org.apache.commons.functor.core.RightIdentity;
@@ -46,13 +46,13 @@ public class TestLeftBoundFunction exten
 
     @Test
     public void testEvaluate() throws Exception {
-        UnaryFunction<Object, Object> f = new LeftBoundFunction<Object, Object>(RightIdentity.FUNCTION,"foo");
+        Function<Object, Object> f = new LeftBoundFunction<Object, Object>(RightIdentity.FUNCTION,"foo");
         assertEquals("xyzzy",f.evaluate("xyzzy"));
     }
 
     @Test
     public void testEquals() throws Exception {
-        UnaryFunction<Object, Object> f = new LeftBoundFunction<Object, Object>(RightIdentity.FUNCTION,"xyzzy");
+        Function<Object, Object> f = new LeftBoundFunction<Object, Object>(RightIdentity.FUNCTION,"xyzzy");
         assertEquals(f,f);
         assertObjectsAreEqual(f,new LeftBoundFunction<Object, Object>(RightIdentity.FUNCTION,"xyzzy"));
         assertObjectsAreNotEqual(f,Constant.of("xyzzy"));

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundPredicate.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundPredicate.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundPredicate.java Tue Jul 30 22:48:02 2013
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryPredicate;
+import org.apache.commons.functor.Predicate;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.RightIdentity;
 import org.junit.Test;
@@ -46,7 +46,7 @@ public class TestLeftBoundPredicate exte
 
     @Test
     public void testTest() throws Exception {
-        UnaryPredicate<Boolean> p = new LeftBoundPredicate<Boolean>(
+        Predicate<Boolean> p = new LeftBoundPredicate<Boolean>(
                 new BinaryFunctionBinaryPredicate<Object, Boolean>(RightIdentity.<Object, Boolean> function()), "foo");
         assertTrue(p.test(Boolean.TRUE));
         assertFalse(p.test(Boolean.FALSE));
@@ -54,7 +54,7 @@ public class TestLeftBoundPredicate exte
 
     @Test
     public void testEquals() throws Exception {
-        UnaryPredicate<Boolean> p = new LeftBoundPredicate<Boolean>(Constant.TRUE,"xyzzy");
+        Predicate<Boolean> p = new LeftBoundPredicate<Boolean>(Constant.TRUE,"xyzzy");
         assertEquals(p,p);
         assertObjectsAreEqual(p,new LeftBoundPredicate<Boolean>(Constant.TRUE,"xyzzy"));
         assertObjectsAreNotEqual(p,Constant.TRUE);

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundProcedure.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundProcedure.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestLeftBoundProcedure.java Tue Jul 30 22:48:02 2013
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryProcedure;
+import org.apache.commons.functor.Procedure;
 import org.apache.commons.functor.core.NoOp;
 import org.apache.commons.functor.core.RightIdentity;
 import org.junit.Test;
@@ -45,7 +45,7 @@ public class TestLeftBoundProcedure exte
 
     @Test
     public void testRun() throws Exception {
-        UnaryProcedure<Object> p = new LeftBoundProcedure<Object>(
+        Procedure<Object> p = new LeftBoundProcedure<Object>(
                 new BinaryFunctionBinaryProcedure<Object, Object>(RightIdentity.FUNCTION), "foo");
         p.run(Boolean.TRUE);
         p.run(Boolean.FALSE);
@@ -53,7 +53,7 @@ public class TestLeftBoundProcedure exte
 
     @Test
     public void testEquals() throws Exception {
-        UnaryProcedure<Object> f = new LeftBoundProcedure<Object>(NoOp.INSTANCE, "xyzzy");
+        Procedure<Object> f = new LeftBoundProcedure<Object>(NoOp.INSTANCE, "xyzzy");
         assertEquals(f, f);
         assertObjectsAreEqual(f, new LeftBoundProcedure<Object>(NoOp.INSTANCE, "xyzzy"));
         assertObjectsAreNotEqual(f, new NoOp());

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Function;
+import org.apache.commons.functor.core.Constant;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryFunctionFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryFunctionFunction<Object, Object>(Constant.of("xyzzy"));
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        Function<Object, Object> f = new NullaryFunctionFunction<Object, Object>(Constant.of("xyzzy"));
+        assertEquals("xyzzy",f.evaluate(null));
+        assertEquals("xyzzy",f.evaluate("abc"));
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Function<Object, Object> f = new NullaryFunctionFunction<Object, Object>(Constant.of("xyzzy"));
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new NullaryFunctionFunction<Object, Object>(Constant.of("xyzzy")));
+        assertObjectsAreNotEqual(f,Constant.of("x"));
+        assertObjectsAreNotEqual(f,new NullaryFunctionFunction<Object, Object>(Constant.of(null)));
+        assertObjectsAreNotEqual(f,Constant.of(null));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryFunctionFunction.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryFunctionFunction.adapt(Constant.of("xyzzy")));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryPredicate.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryPredicate.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryPredicate.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryPredicate;
+import org.apache.commons.functor.core.Constant;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryFunctionNullaryPredicate extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryFunctionNullaryPredicate(Constant.TRUE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTestWhenTrue() throws Exception {
+        NullaryPredicate p = new NullaryFunctionNullaryPredicate(Constant.TRUE);
+        assertTrue(p.test());
+    }
+
+    @Test
+    public void testTestWhenFalse() throws Exception {
+        NullaryPredicate p = new NullaryFunctionNullaryPredicate(Constant.FALSE);
+        assertTrue(!p.test());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryPredicate p = new NullaryFunctionNullaryPredicate(Constant.TRUE);
+        assertEquals(p,p);
+        assertObjectsAreEqual(p,new NullaryFunctionNullaryPredicate(Constant.TRUE));
+        assertObjectsAreNotEqual(p,Constant.TRUE);
+        assertObjectsAreNotEqual(p,new NullaryFunctionNullaryPredicate(Constant.FALSE));
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryFunctionNullaryPredicate.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryFunctionNullaryPredicate.adapt(Constant.TRUE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryProcedure.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryProcedure.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryFunctionNullaryProcedure.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryFunction;
+import org.apache.commons.functor.NullaryProcedure;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.NoOp;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryFunctionNullaryProcedure extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryFunctionNullaryProcedure(Constant.of("K"));
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testRun() throws Exception {
+        class EvaluateCounter implements NullaryFunction<Integer> {
+            int count = 0;
+            public Integer evaluate() { return Integer.valueOf(count++); }
+        }
+        EvaluateCounter counter = new EvaluateCounter();
+        NullaryProcedure p = new NullaryFunctionNullaryProcedure(counter);
+        assertEquals(0,counter.count);
+        p.run();
+        assertEquals(1,counter.count);
+        p.run();
+        assertEquals(2,counter.count);
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryProcedure p = new NullaryFunctionNullaryProcedure(Constant.of("K"));
+        assertEquals(p,p);
+        assertObjectsAreEqual(p,new NullaryFunctionNullaryProcedure(Constant.of("K")));
+        assertObjectsAreNotEqual(p,NoOp.INSTANCE);
+        assertObjectsAreNotEqual(p,new NullaryFunctionNullaryProcedure(Constant.of("J")));
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryFunctionNullaryProcedure.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryFunctionNullaryProcedure.adapt(Constant.of("K")));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicateNullaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicateNullaryFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicateNullaryFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicateNullaryFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryFunction;
+import org.apache.commons.functor.core.Constant;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryPredicateNullaryFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryPredicateNullaryFunction(Constant.of(Boolean.TRUE));
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testTestWhenTrue() throws Exception {
+        NullaryFunction<Boolean> f = new NullaryPredicateNullaryFunction(Constant.TRUE);
+        assertEquals(Boolean.TRUE,f.evaluate());
+    }
+
+    @Test
+    public void testTestWhenFalse() throws Exception {
+        NullaryFunction<Boolean> f = new NullaryPredicateNullaryFunction(Constant.FALSE);
+        assertEquals(Boolean.FALSE,f.evaluate());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryFunction<Boolean> f = new NullaryPredicateNullaryFunction(Constant.TRUE);
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new NullaryPredicateNullaryFunction(Constant.TRUE));
+        assertObjectsAreNotEqual(f,Constant.of("x"));
+        assertObjectsAreNotEqual(f,new NullaryPredicateNullaryFunction(Constant.FALSE));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryPredicateNullaryFunction.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryPredicateNullaryFunction.adapt(Constant.TRUE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicatePredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicatePredicate.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicatePredicate.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryPredicatePredicate.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Predicate;
+import org.apache.commons.functor.core.Constant;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryPredicatePredicate extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryPredicatePredicate<Object>(Constant.TRUE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        Predicate<Object> p = new NullaryPredicatePredicate<Object>(Constant.TRUE);
+        assertTrue(p.test(null));
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Predicate<Object> p = new NullaryPredicatePredicate<Object>(Constant.TRUE);
+        assertEquals(p,p);
+        assertObjectsAreEqual(p,new NullaryPredicatePredicate<Object>(Constant.TRUE));
+        assertObjectsAreNotEqual(p,Constant.TRUE);
+        assertObjectsAreNotEqual(p,new NullaryPredicatePredicate<Object>(Constant.FALSE));
+        assertObjectsAreNotEqual(p,Constant.FALSE);
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryPredicatePredicate.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryPredicatePredicate.adapt(Constant.TRUE));
+    }
+}

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryProcedureNullaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryProcedureNullaryFunction.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryProcedureNullaryFunction.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestNullaryProcedureNullaryFunction.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.NullaryFunction;
+import org.apache.commons.functor.NullaryProcedure;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.NoOp;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestNullaryProcedureNullaryFunction extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryProcedureNullaryFunction<Object>(NoOp.INSTANCE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        NullaryFunction<Object> f = new NullaryProcedureNullaryFunction<Object>(NoOp.INSTANCE);
+        assertNull(f.evaluate());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        NullaryFunction<Object> f = new NullaryProcedureNullaryFunction<Object>(NoOp.INSTANCE);
+        assertEquals(f,f);
+        assertObjectsAreEqual(f,new NullaryProcedureNullaryFunction<Object>(NoOp.INSTANCE));
+        assertObjectsAreNotEqual(f,Constant.of("x"));
+        assertObjectsAreNotEqual(f,new NullaryProcedureNullaryFunction<Object>(new NullaryProcedure() { public void run() { } }));
+        assertObjectsAreNotEqual(f,Constant.of(null));
+        assertTrue(!f.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryProcedureNullaryFunction.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryProcedureNullaryFunction.adapt(new NoOp()));
+    }
+}

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestPredicateFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestPredicateFunction.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestPredicateFunction.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestPredicateFunction.java Tue Jul 30 22:48:02 2013
@@ -36,7 +36,7 @@ public class TestPredicateFunction exten
 
     @Override
     protected Object makeFunctor() {
-        return new PredicateFunction(Constant.of(Boolean.TRUE));
+        return new PredicateFunction<Object>(Constant.TRUE);
     }
 
     // Tests
@@ -44,23 +44,23 @@ public class TestPredicateFunction exten
 
     @Test
     public void testTestWhenTrue() throws Exception {
-        Function<Boolean> f = new PredicateFunction(Constant.TRUE);
-        assertEquals(Boolean.TRUE,f.evaluate());
+        Function<Object, Boolean> f = new PredicateFunction<Object>(Constant.TRUE);
+        assertEquals(Boolean.TRUE,f.evaluate(null));
     }
 
     @Test
     public void testTestWhenFalse() throws Exception {
-        Function<Boolean> f = new PredicateFunction(Constant.FALSE);
-        assertEquals(Boolean.FALSE,f.evaluate());
+        Function<Object, Boolean> f = new PredicateFunction<Object>(Constant.FALSE);
+        assertEquals(Boolean.FALSE,f.evaluate(null));
     }
 
     @Test
     public void testEquals() throws Exception {
-        Function<Boolean> f = new PredicateFunction(Constant.TRUE);
+        Function<Object, Boolean> f = new PredicateFunction<Object>(Constant.TRUE);
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new PredicateFunction(Constant.TRUE));
+        assertObjectsAreEqual(f,new PredicateFunction<Object>(Constant.TRUE));
         assertObjectsAreNotEqual(f,Constant.of("x"));
-        assertObjectsAreNotEqual(f,new PredicateFunction(Constant.FALSE));
+        assertObjectsAreNotEqual(f,new PredicateFunction<Object>(Constant.FALSE));
         assertTrue(!f.equals(null));
     }
 

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureFunction.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureFunction.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureFunction.java Tue Jul 30 22:48:02 2013
@@ -38,7 +38,7 @@ public class TestProcedureFunction exten
 
     @Override
     protected Object makeFunctor() {
-        return new ProcedureFunction<Object>(NoOp.INSTANCE);
+        return new ProcedureFunction<Object, Object>(NoOp.INSTANCE);
     }
 
     // Tests
@@ -46,17 +46,20 @@ public class TestProcedureFunction exten
 
     @Test
     public void testEvaluate() throws Exception {
-        Function<Object> f = new ProcedureFunction<Object>(NoOp.INSTANCE);
-        assertNull(f.evaluate());
+        Function<Object, Object> f = new ProcedureFunction<Object, Object>(NoOp.INSTANCE);
+        assertNull(f.evaluate(null));
     }
 
     @Test
     public void testEquals() throws Exception {
-        Function<Object> f = new ProcedureFunction<Object>(NoOp.INSTANCE);
+        Function<Object, Object> f = new ProcedureFunction<Object, Object>(NoOp.INSTANCE);
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new ProcedureFunction<Object>(NoOp.INSTANCE));
+        assertObjectsAreEqual(f,new ProcedureFunction<Object, Object>(NoOp.INSTANCE));
         assertObjectsAreNotEqual(f,Constant.of("x"));
-        assertObjectsAreNotEqual(f,new ProcedureFunction<Object>(new Procedure() { public void run() { } }));
+        assertObjectsAreNotEqual(f, new ProcedureFunction<Object, Object>(new Procedure<Object>() {
+            public void run(Object a) {
+            }
+        }));
         assertObjectsAreNotEqual(f,Constant.of(null));
         assertTrue(!f.equals(null));
     }

Added: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureProcedure.java?rev=1508677&view=auto
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureProcedure.java (added)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestProcedureProcedure.java Tue Jul 30 22:48:02 2013
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.functor.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.functor.BaseFunctorTest;
+import org.apache.commons.functor.Procedure;
+import org.apache.commons.functor.core.Constant;
+import org.apache.commons.functor.core.NoOp;
+import org.apache.commons.functor.core.composite.NullarySequence;
+import org.junit.Test;
+
+/**
+ * @version $Revision: 1365377 $ $Date: 2012-07-24 21:59:23 -0300 (Tue, 24 Jul 2012) $
+ */
+public class TestProcedureProcedure extends BaseFunctorTest {
+
+    // Functor Testing Framework
+    // ------------------------------------------------------------------------
+
+    @Override
+    protected Object makeFunctor() {
+        return new NullaryProcedureProcedure<Object>(NoOp.INSTANCE);
+    }
+
+    // Tests
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEvaluate() throws Exception {
+        Procedure<Object> p = new NullaryProcedureProcedure<Object>(new NullaryFunctionNullaryProcedure(Constant.of(null)));
+        p.run(Boolean.TRUE);
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Procedure<Object> p = new NullaryProcedureProcedure<Object>(NoOp.INSTANCE);
+        assertEquals(p,p);
+        assertObjectsAreEqual(p,new NullaryProcedureProcedure<Object>(NoOp.INSTANCE));
+        assertObjectsAreNotEqual(p,NoOp.INSTANCE);
+        assertObjectsAreNotEqual(p,new NullaryProcedureProcedure<Object>(new NullarySequence()));
+        assertTrue(!p.equals(null));
+    }
+
+    @Test
+    public void testAdaptNull() throws Exception {
+        assertNull(NullaryProcedureProcedure.adapt(null));
+    }
+
+    @Test
+    public void testAdapt() throws Exception {
+        assertNotNull(NullaryProcedureProcedure.adapt(NoOp.INSTANCE));
+    }
+}

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundFunction.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundFunction.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundFunction.java Tue Jul 30 22:48:02 2013
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryFunction;
+import org.apache.commons.functor.Function;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.LeftIdentity;
 import org.apache.commons.functor.core.RightIdentity;
@@ -46,13 +46,13 @@ public class TestRightBoundFunction exte
 
     @Test
     public void testEvaluate() throws Exception {
-        UnaryFunction<String, String> f = RightBoundFunction.bind(LeftIdentity.<String, String>function(),"foo");
+        Function<String, String> f = RightBoundFunction.bind(LeftIdentity.<String, String>function(),"foo");
         assertEquals("xyzzy",f.evaluate("xyzzy"));
     }
 
     @Test
     public void testEquals() throws Exception {
-        UnaryFunction<Object, Object> f = RightBoundFunction.bind(LeftIdentity.FUNCTION,"xyzzy");
+        Function<Object, Object> f = RightBoundFunction.bind(LeftIdentity.FUNCTION,"xyzzy");
         assertEquals(f,f);
         assertObjectsAreEqual(f,new RightBoundFunction<Object, Object>(LeftIdentity.FUNCTION,"xyzzy"));
         assertObjectsAreNotEqual(f,Constant.of("xyzzy"));

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundPredicate.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundPredicate.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundPredicate.java Tue Jul 30 22:48:02 2013
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryPredicate;
+import org.apache.commons.functor.Predicate;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.LeftIdentity;
 import org.junit.Test;
@@ -46,7 +46,7 @@ public class TestRightBoundPredicate ext
 
     @Test
     public void testTest() throws Exception {
-        UnaryPredicate<Boolean> f = new RightBoundPredicate<Boolean>(
+        Predicate<Boolean> f = new RightBoundPredicate<Boolean>(
                 new BinaryFunctionBinaryPredicate<Boolean, Object>(LeftIdentity.<Boolean, Object> function()), "foo");
         assertTrue(f.test(Boolean.TRUE));
         assertFalse(f.test(Boolean.FALSE));
@@ -54,7 +54,7 @@ public class TestRightBoundPredicate ext
 
     @Test
     public void testEquals() throws Exception {
-        UnaryPredicate<Boolean> f = new RightBoundPredicate<Boolean>(Constant.TRUE, "xyzzy");
+        Predicate<Boolean> f = new RightBoundPredicate<Boolean>(Constant.TRUE, "xyzzy");
         assertEquals(f, f);
         assertObjectsAreEqual(f, new RightBoundPredicate<Boolean>(Constant.TRUE, "xyzzy"));
         assertObjectsAreNotEqual(f, Constant.TRUE);

Modified: commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundProcedure.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundProcedure.java?rev=1508677&r1=1508676&r2=1508677&view=diff
==============================================================================
--- commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundProcedure.java (original)
+++ commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/adapter/TestRightBoundProcedure.java Tue Jul 30 22:48:02 2013
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.UnaryProcedure;
+import org.apache.commons.functor.Procedure;
 import org.apache.commons.functor.core.LeftIdentity;
 import org.apache.commons.functor.core.NoOp;
 import org.apache.commons.functor.core.composite.BinarySequence;
@@ -46,7 +46,7 @@ public class TestRightBoundProcedure ext
 
     @Test
     public void testRun() throws Exception {
-        UnaryProcedure<Object> p = new RightBoundProcedure<Object>(
+        Procedure<Object> p = new RightBoundProcedure<Object>(
                 new BinaryFunctionBinaryProcedure<Object, Object>(LeftIdentity.FUNCTION), "foo");
         p.run(Boolean.TRUE);
         p.run(Boolean.FALSE);
@@ -54,7 +54,7 @@ public class TestRightBoundProcedure ext
 
     @Test
     public void testEquals() throws Exception {
-        UnaryProcedure<Object> f = new RightBoundProcedure<Object>(NoOp.INSTANCE,"xyzzy");
+        Procedure<Object> f = new RightBoundProcedure<Object>(NoOp.INSTANCE,"xyzzy");
         assertEquals(f,f);
         assertObjectsAreEqual(f,new RightBoundProcedure<Object>(NoOp.INSTANCE,"xyzzy"));
         assertObjectsAreNotEqual(f,NoOp.INSTANCE);



Mime
View raw message