I am trying to mock this method that utilizes a declared private field from this class. However, I am unsure as to why I am getting the AssertionError on the Mockito.doNothing() line, when the method someMethod clearly takes in two strings, which I have taken account for.
Error:
java.lang.AssertionError
Code:
class Main{
private Person person;
...
public void testMethod() {
person.someMethod("string1", "string2");
...
}
}
class Person{
public void someMethod(String a, String b){
... do something ...
}
}
class TestMain(){
@InjectMocks
private Main testee;
@Mock
private Person person;
@Test
testTestMethod(){
Mockito.doNothing().when(person).someMethod(any(String.class), any(String.class));
}
}
Aucun commentaire:
Enregistrer un commentaire