This question already has an answer here:
I have my method
public void devide(int a, int b){
try{
int c = a/b;
}catch(Exception e){
e.printStackTrace();
}
}
This in my test method
@Test
public void testDevide_notSuccess_ExceptionOccur(){
int a=5;
int b=0;
devide(a,b); //of course will go to "catch"
}
So my question is : how can i assert(or something) that tell me that the test case is going to "catch" branch?
Aucun commentaire:
Enregistrer un commentaire