1 package uk.co.jezuk.mango; 2 3 import junit.framework.*; 4 5 public class FindPositionTest extends TestCase 6 { 7 java.util.List list; 8 9 public FindPositionTest(String name) { super(name); } 10 public static Test suite() { return new TestSuite(FindPositionTest.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(2, Algorithms.findPosition(list, new Integer (2))); 22 } 23 24 public void test2() 25 { 26 assertEquals(4, Algorithms.findPosition(list, new Integer (4))); 27 } 28 29 public void test3() 30 { 31 assertEquals(7, Algorithms.findPosition(list, new Integer (7))); 32 } 33 34 public void test4() 35 { 36 assertEquals(-1, Algorithms.findPosition(list, new Integer (99))); 37 } 38 39 public void test5() 40 { 41 assertEquals(-1, Algorithms.findPosition(list, new String ("charles dickens"))); 42 } } | Popular Tags |