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