2016-11-24 69 views

回答

0

測試執行期望引發的異常。請使用:如果你的代碼拋出預期的異常

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

的測試將通過和失敗的斷言失敗和任何其他異常的代碼拋出。