I have this:
class MyClass {
private String foo;
public getFoo() { return foo; }
public setFoo(String foo) { this.foo = foo; }
}
Now, I want to mock it.
MyClass m = Mockito.mock(MyClass.class);
when(m.getFoo()).thenCallRealMethod();
when(m.setFoo(Mockito.anyString())).thenCallRealMethod();
But this gives me this compile error:
'void' type not allowed here
Using thenCallRealMethod()
seems to work for methods with no arguments, but I cannot get it to work with arguments. What am I doing wrong?