1 package uk.co.jezuk.mango; 2 3 import junit.framework.*; 4 5 public class FindIfNotTest extends TestCase 6 { 7 java.util.List list; 8 9 public FindIfNotTest(String name) { super(name); } 10 public static Test suite() { return new TestSuite(FindIfNotTest.class); } 11 12 protected void setUp() 13 { 14 list = new java.util.ArrayList (); 15 for(int i = 0; i < 10; ++i) 16 list.add(new Integer (i)); 17 } 19 public void test1() 20 { 21 assertEquals(list.get(2), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThanEquals(), new Integer (1)))); 22 } 24 public void test2() 25 { 26 assertEquals(list.get(4), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer (4)))); 27 } 29 public void test3() 30 { 31 assertEquals(list.get(7), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer (7)))); 32 } 34 public void test4() 35 { 36 assertEquals(null, Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer (99)))); 37 } 39 public void test5() 40 { 41 assertEquals(null, Algorithms.findIfNot(list, Bind.First(Predicates.NotEqualTo(), new String ("charles dickens")))); 42 } 44 public void test6() 45 { 46 assertEquals(list.get(0), Algorithms.findIfNot(list, Bind.First(Predicates.EqualTo(), new String ("charles dickens")))); 47 } } | Popular Tags |