我从 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
最佳答案
我认为这是一个 IntelliJ Idea 错误。参见 https://github.com/junit-team/junit/issues/1104
关于java - jUnit ErrorCollector 报告重复行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32973163/