BinaryOrTest.java :  » Development » mango » uk » co » jezuk » mango » Java Open Source

Java Open Source » Development » mango 
mango » uk » co » jezuk » mango » BinaryOrTest.java
package uk.co.jezuk.mango;

import junit.framework.*;

public class BinaryOrTest  extends TestCase
{
  public BinaryOrTest(String name) { super(name); }
  public static Test suite() { return new TestSuite(BinaryOrTest.class); }

    private static class t implements BinaryPredicate { public boolean test(Object x, Object y) { return true; } }
    private static class f implements BinaryPredicate { public boolean test(Object x, Object y) { return false; } }

  public void test1()
  {
    BinaryPredicate o = Predicates.Or(new t(), new t());
    assertEquals(true, o.test(null, null));
  } // test1

  public void test2()
  {
    BinaryPredicate o = Predicates.Or(new f(), new t());
    assertEquals(true, o.test(null, null));
  } // test2

  public void test3()
  {
    BinaryPredicate o = Predicates.Or(new t(), new f());
    assertEquals(true, o.test(null, null));
  } // test3

  public void test4()
  {
    BinaryPredicate o = Predicates.Or(new f(), new f());
    assertEquals(false, o.test(null, null));
  } // test4
} // BinaryOrTest
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.