rwaldhoff 2003/01/29 15:24:53
Modified: functor/src/test/org/apache/commons/functor/core/composite
TestConditionalBinaryFunction.java
TestConditionalBinaryProcedure.java
TestConditionalUnaryFunction.java
TestConditionalUnaryPredicate.java
TestConditionalUnaryProcedure.java
Log:
use IdentityPredicates in places where we were adapting IdentityFunction
Revision Changes Path
1.2 +7 -8
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java
Index: TestConditionalBinaryFunction.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryFunction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestConditionalBinaryFunction.java 27 Jan 2003 19:33:43 -0000 1.1
+++ TestConditionalBinaryFunction.java 29 Jan 2003 23:24:52 -0000 1.2
@@ -60,10 +60,9 @@
import junit.framework.TestSuite;
import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.adapter.BinaryFunctionBinaryPredicate;
import org.apache.commons.functor.core.ConstantFunction;
import org.apache.commons.functor.core.ConstantPredicate;
-import org.apache.commons.functor.core.LeftIdentityFunction;
+import org.apache.commons.functor.core.LeftIdentityPredicate;
/**
* @version $Revision$ $Date$
@@ -108,7 +107,7 @@
public void testEvaluate() throws Exception {
ConditionalBinaryFunction f = new ConditionalBinaryFunction(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right"));
assertEquals("left",f.evaluate(Boolean.TRUE,null));
@@ -117,16 +116,16 @@
public void testEquals() throws Exception {
ConditionalBinaryFunction f = new ConditionalBinaryFunction(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right"));
assertEquals(f,f);
assertObjectsAreEqual(f,new ConditionalBinaryFunction(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right")));
assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new ConstantFunction(null),
new ConstantFunction("right")));
assertObjectsAreNotEqual(f,new ConditionalBinaryFunction(
1.2 +8 -9
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java
Index: TestConditionalBinaryProcedure.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalBinaryProcedure.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestConditionalBinaryProcedure.java 27 Jan 2003 19:33:43 -0000 1.1
+++ TestConditionalBinaryProcedure.java 29 Jan 2003 23:24:52 -0000 1.2
@@ -61,9 +61,8 @@
import org.apache.commons.functor.BaseFunctorTest;
import org.apache.commons.functor.BinaryProcedure;
-import org.apache.commons.functor.adapter.BinaryFunctionBinaryPredicate;
import org.apache.commons.functor.core.ConstantPredicate;
-import org.apache.commons.functor.core.LeftIdentityFunction;
+import org.apache.commons.functor.core.LeftIdentityPredicate;
import org.apache.commons.functor.core.NoOpProcedure;
/**
@@ -111,7 +110,7 @@
RunCounter left = new RunCounter();
RunCounter right = new RunCounter();
ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
left,
right);
assertEquals(0,left.count);
@@ -129,12 +128,12 @@
public void testEquals() throws Exception {
ConditionalBinaryProcedure p = new ConditionalBinaryProcedure(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new NoOpProcedure(),
new NoOpProcedure());
assertEquals(p,p);
assertObjectsAreEqual(p,new ConditionalBinaryProcedure(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new NoOpProcedure(),
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
@@ -146,11 +145,11 @@
new NoOpProcedure(),
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
null,
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalBinaryProcedure(
- new BinaryFunctionBinaryPredicate(new LeftIdentityFunction()),
+ new LeftIdentityPredicate(),
new NoOpProcedure(),
null));
}
1.2 +7 -8
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryFunction.java
Index: TestConditionalUnaryFunction.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryFunction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestConditionalUnaryFunction.java 27 Jan 2003 19:33:43 -0000 1.1
+++ TestConditionalUnaryFunction.java 29 Jan 2003 23:24:52 -0000 1.2
@@ -60,10 +60,9 @@
import junit.framework.TestSuite;
import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.adapter.UnaryFunctionUnaryPredicate;
import org.apache.commons.functor.core.ConstantFunction;
import org.apache.commons.functor.core.ConstantPredicate;
-import org.apache.commons.functor.core.IdentityFunction;
+import org.apache.commons.functor.core.IdentityPredicate;
/**
* @version $Revision$ $Date$
@@ -108,7 +107,7 @@
public void testEvaluate() throws Exception {
ConditionalUnaryFunction f = new ConditionalUnaryFunction(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right"));
assertEquals("left",f.evaluate(Boolean.TRUE));
@@ -117,16 +116,16 @@
public void testEquals() throws Exception {
ConditionalUnaryFunction f = new ConditionalUnaryFunction(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right"));
assertEquals(f,f);
assertObjectsAreEqual(f,new ConditionalUnaryFunction(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantFunction("left"),
new ConstantFunction("right")));
assertObjectsAreNotEqual(f,new ConditionalUnaryFunction(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantFunction(null),
new ConstantFunction("right")));
assertObjectsAreNotEqual(f,new ConditionalUnaryFunction(
1.2 +7 -8
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryPredicate.java
Index: TestConditionalUnaryPredicate.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryPredicate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestConditionalUnaryPredicate.java 27 Jan 2003 19:33:43 -0000 1.1
+++ TestConditionalUnaryPredicate.java 29 Jan 2003 23:24:52 -0000 1.2
@@ -60,9 +60,8 @@
import junit.framework.TestSuite;
import org.apache.commons.functor.BaseFunctorTest;
-import org.apache.commons.functor.adapter.UnaryFunctionUnaryPredicate;
import org.apache.commons.functor.core.ConstantPredicate;
-import org.apache.commons.functor.core.IdentityFunction;
+import org.apache.commons.functor.core.IdentityPredicate;
/**
* @version $Revision$ $Date$
@@ -107,7 +106,7 @@
public void testTest() throws Exception {
ConditionalUnaryPredicate p = new ConditionalUnaryPredicate(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantPredicate(true),
new ConstantPredicate(false));
assertTrue(p.test(Boolean.TRUE));
@@ -116,16 +115,16 @@
public void testEquals() throws Exception {
ConditionalUnaryPredicate p = new ConditionalUnaryPredicate(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantPredicate(true),
new ConstantPredicate(true));
assertEquals(p,p);
assertObjectsAreEqual(p,new ConditionalUnaryPredicate(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantPredicate(true),
new ConstantPredicate(true)));
assertObjectsAreNotEqual(p,new ConditionalUnaryPredicate(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new ConstantPredicate(false),
new ConstantPredicate(true)));
assertObjectsAreNotEqual(p,new ConditionalUnaryPredicate(
1.2 +8 -9
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryProcedure.java
Index: TestConditionalUnaryProcedure.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/composite/TestConditionalUnaryProcedure.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestConditionalUnaryProcedure.java 27 Jan 2003 19:33:43 -0000 1.1
+++ TestConditionalUnaryProcedure.java 29 Jan 2003 23:24:52 -0000 1.2
@@ -61,9 +61,8 @@
import org.apache.commons.functor.BaseFunctorTest;
import org.apache.commons.functor.UnaryProcedure;
-import org.apache.commons.functor.adapter.UnaryFunctionUnaryPredicate;
import org.apache.commons.functor.core.ConstantPredicate;
-import org.apache.commons.functor.core.IdentityFunction;
+import org.apache.commons.functor.core.IdentityPredicate;
import org.apache.commons.functor.core.NoOpProcedure;
/**
@@ -111,7 +110,7 @@
RunCounter left = new RunCounter();
RunCounter right = new RunCounter();
ConditionalUnaryProcedure p = new ConditionalUnaryProcedure(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
left,
right);
assertEquals(0,left.count);
@@ -129,12 +128,12 @@
public void testEquals() throws Exception {
ConditionalUnaryProcedure p = new ConditionalUnaryProcedure(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new NoOpProcedure(),
new NoOpProcedure());
assertEquals(p,p);
assertObjectsAreEqual(p,new ConditionalUnaryProcedure(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new NoOpProcedure(),
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
@@ -146,11 +145,11 @@
new NoOpProcedure(),
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
null,
new NoOpProcedure()));
assertObjectsAreNotEqual(p,new ConditionalUnaryProcedure(
- new UnaryFunctionUnaryPredicate(new IdentityFunction()),
+ new IdentityPredicate(),
new NoOpProcedure(),
null));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]