Class MyClass{
method3(){
if(condition){
method1()
}
else{
method2()
}
}
method1(){
//do woo
}
method3(){
//do foo
}
}
I am trying to test method3
only if case is called so else method is not called.
MyClass myClassMock= mock(MyClass.class);
myClassMock.method3();
verify( myClassMock, times(0)).method2();
But then this calls my method2
and throws null pointer inside method2
. How can I test this without calling method2
because my behavior wont call method2
.