3
我从jUnit wiki中找到了下面的示例。我期望错误表应该不断地报告两个错误。但有时它会报告第二个错误两次。任何解释?jUnit ErrorCollector报告重复行
public class ErrorCollectorRuleTest {
@Rule
public ErrorCollector collector= new ErrorCollector();
@Test
public void example() {
collector.addError(new Throwable("first thing went wrong"));
collector.addError(new Throwable("second thing went wrong"));
System.out.println("Completed");
}
}
输出:
Completed
java.lang.Throwable: first thing went wrong
java.lang.Throwable: second thing went wrong
java.lang.Throwable: second thing went wrong
你是如何破坏测试的:Maven,Eclipse,命令行......? –
@StefanBirkner Intellij – Bryan