junit4 测试错误

junit4 测试异常在@Test标签后加要测的异常参数就行了。如?@Test(expected IndexOutOfBoundsException.cla

junit4 测试异常

在@Test标签后加要测的异常参数就行了。如?@Test(expected= IndexOutOfBoundsException.class)

?

?

@Test(expected= IndexOutOfBoundsException.class)public void testSomething(){  ArrayList list = new ArrayList();  list.get(0);}
?

?

?

?