Reputation: 794
In the middle of the test, if the condition of the test is not satisfied, how can I skip the test without failing it.
I try to throw an exception and it is marked as failed.
Upvotes: 1
Views: 1543
Reputation: 5293
I think you can use some thing like
try {
///some process
try {
///your middle test
}catch (excetion e){
}
}catch (excetion e){
}
If the middle test is failed the rest will work
Upvotes: 0
Reputation: 2267
You will need to use the assume:
org.junit.Assume.assumeTrue(condition());
If this fails your test will be ignored. I recommend doing this assume in your @Before method
Hope this helps
Upvotes: 3