我正在尝试使用 @Rule注释ExpectedException
用于初始化ExceptionedException 变量类型的ExceptionedException.none()方法表示不推荐使用哪些替代方法来初始化ExceptionedException 的对象。例子:
public ExpectedException expectedException = ExpectedException.none();
@Test
public void testThrownException() throws Exception {
expectedException.expect(CustomException.class);
expectedException.expectMessage("Exception Message");
...
}
Run Code Online (Sandbox Code Playgroud)