In Java with JUnit 3
-
public void testIndexOutOfBounds() {
-
try {
-
new ArrayList().get(0);
-
fail("Should have thrown exception");
-
} catch (IndexOutOfBoundsException e) {
-
assertEquals("Index: 0, Size: 0", e.getMessage());
-
}
-
}
In Java with JUnit 3
Use this link to trackback from your own site.