In Java with JUnit 3
1 2 3 4 5 6 7 8 |
public void testIndexOutOfBounds() { try { new ArrayList().get(0); fail("Should have thrown exception"); } catch (IndexOutOfBoundsException e) { assertEquals("Index: 0, Size: 0", e.getMessage()); } } |