KickJava   Java API By Example, From Geeks To Geeks.

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


1 package uk.co.jezuk.mango;
2
3 import junit.framework.*;
4
5 public class FindTest extends TestCase
6 {
7   java.util.List JavaDoc list;
8
9   public FindTest(String JavaDoc name) { super(name); }
10   public static Test suite() { return new TestSuite(FindTest.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.find(list, new Integer JavaDoc(2)));
22     assertEquals(list.get(4), Algorithms.find(list, new Integer JavaDoc(4)));
23     assertEquals(list.get(7), Algorithms.find(list, new Integer JavaDoc(7)));
24     assertEquals(null, Algorithms.find(list, new Integer JavaDoc(99)));
25     assertEquals(null, Algorithms.find(list, new String JavaDoc("charles dickens")));
26   } //
27
} // FindTest
28
Popular Tags