I have an interface -
Interface Intf {
public void intfMethod();
}
and 2 classes A and B implementing it
I am testing below class using JUnit and Mockito -
class CUT {
//Gets initialized as null
private Intf i;
//Gets autowired as object of A
private Intf a;
//Gets autowired as object of B
private Intf b;
public void myMethod(SomeClass param) {
if(param.getCondition())
i = a;
} else {
i = b;
}
i.intfMethod();
}
}
How do I verify in my test that the intfMethod() of the correct implementation was called?
Aucun commentaire:
Enregistrer un commentaire