2016-11-24 68 views

回答

0

测试执行期望引发的异常。请使用:如果你的代码抛出预期的异常

@Test(expected=<ExpectedException>.class) 
public void testThrownException() { 
// Your test code that throws the expected exception 
} 

的测试将通过和失败的断言失败和任何其他异常的代码抛出。