KickJava   Java API By Example, From Geeks To Geeks.

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


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

27   public void test2()
28   {
29     Algorithms.remove(list, 1, 5, new Integer JavaDoc(7));
30
31     assertEquals(10, list.size());
32     assertEquals(list.get(7), Algorithms.find(list, new Integer JavaDoc(7)));
33   } // test2
34
} // FindTest
35
Popular Tags