/** remove throws an IndexOutOfBoundsException on a negative index */ public void testRemove1_IndexOutOfBounds() { try { List c = emptyArray(); c.remove(-1); shouldThrow(); } catch (IndexOutOfBoundsException e) { } }
/** remove throws an IndexOutOfBoundsException on a too high index */ public void testRemove2_IndexOutOfBounds() { try { List c = emptyArray(); c.add("asdasd"); c.add("adasdasd"); c.remove(100); shouldThrow(); } catch (IndexOutOfBoundsException e) { } }
/** remove removes and returns the object at the given index */ public void testRemove() { List full = populatedArray(3); assertEquals(two, full.remove(2)); assertEquals(2, full.size()); }