Duplicate: Java: How to test methods that call System.exit()?
Hello,
I am having a bit of a trouble designing a unit test for a method that exits the application by calling system.exit(). Actually this is the constructor of a class which tests some conditions and decides to exit the application. So it is this particular eventuallity that I'd like to test.
Is there a particular assert that I could use , or any other suggestions?
Many thanks in advance
public MyClass(arg1, arg2, arg3){
if(argsTestingIsOK){
continue;
}else{
System.exit(0);
}
}