Reputation: 939
I try to run junit tests in parallel. But while my test has to finish they dont't. My jenkins running and seems like not gonna end.
The error is:
org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 0.
at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
at java.lang.Runtime.exit(Runtime.java:107)
at java.lang.System.exit(System.java:962)
at org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:144)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:127)
Exception in thread "main" org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 1.
at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
at java.lang.Runtime.exit(Runtime.java:107)
at java.lang.System.exit(System.java:962)
at org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:144)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:135)
Exception in thread "Thread-5" Exception in thread "Thread-6" org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 1.
at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
at java.lang.Runtime.halt(Runtime.java:273)
at org.apache.maven.surefire.booter.ForkedBooter$1.run(ForkedBooter.java:176)
at java.lang.Thread.run(Thread.java:744)
org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 0.
at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
at java.lang.Runtime.halt(Runtime.java:273)
at org.apache.maven.surefire.booter.ForkedBooter$1.run(ForkedBooter.java:176)
at java.lang.Thread.run(Thread.java:744)
In my class I have:
@Rule
public final ExpectedSystemExit expectedSystemExit = ExpectedSystemExit.none();
And
if(carInsuranceSteps.isCheackReservationAddressNotFoundError()) {
Thucydides.takeScreenshot();
expectedSystemExit.expectSystemExitWithStatus(0);
System.exit(0);
}
Upvotes: 0
Views: 1249
Reputation: 24530
The exception is thrown by System Rules. It must replace the SecurityManager in order to test System.exit()
and afterwards restores the original SecurityManager. This means that you cannot run multiple tests with System Rules in parallel in the same JVM.
Upvotes: 1