Suppose I have a class with two methods where I don\'t care which is called...
public class Foo {
public String getProperty(String key) {
return
In your particular case, getProperty(String)
calls getProperty(String, String)
internally.
public String getProperty(String key) {
/*
* getProperty(String, String) is called anyway.
* Why not simply verify the occurrence of that?
*/
return getProperty(key, null);
}
Simply verifying the second method would be equivalent to verifying the occurrence of either one or the other at least once.
Mockito.verify(foo, atLeastOnce()).getProperty(anyString(), anyString());