1 package uk.co.jezuk.mango; 2 3 import junit.framework.*; 4 5 public class RemoveTest extends TestCase 6 { 7 java.util.List list; 8 9 public RemoveTest(String 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 (); 15 for(int i = 0; i < 10; ++i) 16 list.add(new Integer (i)); 17 } 19 public void test1() 20 { 21 Algorithms.remove(list, new Integer (7)); 22 23 assertEquals(9, list.size()); 24 assertEquals(null, Algorithms.find(list, new Integer (7))); 25 } 27 public void test2() 28 { 29 Algorithms.remove(list, 1, 5, new Integer (7)); 30 31 assertEquals(10, list.size()); 32 assertEquals(list.get(7), Algorithms.find(list, new Integer (7))); 33 } } | Popular Tags |