Junit主函数被调用了两次
使用预期的系统出口时出现问题 当使用args调用main类时,输出会出现两次,当我尝试使用ExpectedSystemExit运行时,它工作正常,但由于它在main中有exit(0),我面临这个问题Junit主函数被调用了两次,junit,main,Junit,Main,使用预期的系统出口时出现问题 当使用args调用main类时,输出会出现两次,当我尝试使用ExpectedSystemExit运行时,它工作正常,但由于它在main中有exit(0),我面临这个问题 public class Test { @Rule public final ExpectedSystemExit exit = ExpectedSystemExit.none(); @Test public void Creation() throws Except
public class Test {
@Rule
public final ExpectedSystemExit exit = ExpectedSystemExit.none();
@Test
public void Creation() throws Exception {
exit.expectSystemExitWithStatus(0);;
exit.checkAssertionAfterwards(new Assertion() {
@Override
public void checkAssertion() throws Exception {
System.out.println("Main called twice we can ignore the above ERROR");
}
});
Generator class for testing main function present inside it
从本地目录中的目录中拾取文件
main(新字符串[]{“输入路径”});
}