KickJava   Java API By Example, From Geeks To Geeks.

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


1 package uk.co.jezuk.mango;
2
3 import junit.framework.*;
4
5 public class FindIfNotTest extends TestCase
6 {
7   java.util.List JavaDoc list;
8
9   public FindIfNotTest(String JavaDoc 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 JavaDoc();
15     for(int i = 0; i < 10; ++i)
16       list.add(new Integer JavaDoc(i));
17   } // setUp
18

19   public void test1()
20   {
21     assertEquals(list.get(2), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThanEquals(), new Integer JavaDoc(1))));
22   } // test1
23

24   public void test2()
25   {
26     assertEquals(list.get(4), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer JavaDoc(4))));
27   } // test2
28

29   public void test3()
30   {
31     assertEquals(list.get(7), Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer JavaDoc(7))));
32   } // test3
33

34   public void test4()
35   {
36     assertEquals(null, Algorithms.findIfNot(list, Bind.First(Predicates.GreaterThan(), new Integer JavaDoc(99))));
37   } // test4
38

39   public void test5()
40   {
41     assertEquals(null, Algorithms.findIfNot(list, Bind.First(Predicates.NotEqualTo(), new String JavaDoc("charles dickens"))));
42   } // test5
43

44   public void test6()
45   {
46     assertEquals(list.get(0), Algorithms.findIfNot(list, Bind.First(Predicates.EqualTo(), new String JavaDoc("charles dickens"))));
47   } //
48
} // FindIfNotTest
49
Popular Tags