I tried solution given in Exception : mockito wanted but not invoked, Actually there were zero interactions with this mock and this one too Mockito - Wanted but not invoked: Actually, there were zero interactions with this mock but Still getting the same error. Am I missing something? Here is me implementation:-
class ClassOne {
public void method (ClassTwo);
}
class ClassTwo{
public ClassTwo(String){
...
}
}
class MyClassTwo extends ClassTwo {
public MyClassTwo(String) {
super(String);
}
}
class ClassToBeTested {
ClassOne classOne ;
public ClassToBeTested(){
classOne= new ClassOne();
}
public void methodToBeTested(){
ClassTwo event=new MyClassTwo(String);
classOne.method(event);
}
}
class ClassToBeTestedTest {
ClassToBeTested presenter;
@Mock
ClassOne classOne;
@Before
void setUp(){
presenter=new ClassToBeTested();
}
@Test
testAbc(){
presenter.methodToBeTested();
ClassTwo event = new MyClassTwo(someString);
verify(classOne).method(event);
}
}
Aucun commentaire:
Enregistrer un commentaire