romach
4/20/2017 - 6:52 PM

JUnit assert exception

JUnit assert exception

@Test(expected=IndexOutOfBoundsException.class)
public void testIndexOutOfBoundsException() {
    ArrayList emptyList = new ArrayList();
    Object o = emptyList.get(0);
}