我在jUnit wiki中找到了以下示例。我希望错误表应该不断报告两个错误。但有时它会报告第二次错误两次。任何解释?
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