KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > uk > co > jezuk > mango > BinaryOrTest


1 package uk.co.jezuk.mango;
2
3 import junit.framework.*;
4
5 public class BinaryOrTest extends TestCase
6 {
7   public BinaryOrTest(String JavaDoc name) { super(name); }
8   public static Test suite() { return new TestSuite(BinaryOrTest.class); }
9
10     private static class t implements BinaryPredicate { public boolean test(Object JavaDoc x, Object JavaDoc y) { return true; } }
11     private static class f implements BinaryPredicate { public boolean test(Object JavaDoc x, Object JavaDoc y) { return false; } }
12
13   public void test1()
14   {
15     BinaryPredicate o = Predicates.Or(new t(), new t());
16     assertEquals(true, o.test(null, null));
17   } // test1
18

19   public void test2()
20   {
21     BinaryPredicate o = Predicates.Or(new f(), new t());
22     assertEquals(true, o.test(null, null));
23   } // test2
24

25   public void test3()
26   {
27     BinaryPredicate o = Predicates.Or(new t(), new f());
28     assertEquals(true, o.test(null, null));
29   } // test3
30

31   public void test4()
32   {
33     BinaryPredicate o = Predicates.Or(new f(), new f());
34     assertEquals(false, o.test(null, null));
35   } // test4
36
} // BinaryOrTest
37
Popular Tags