Mockito: Verifying overloaded methods with type-compatible arguments
Consider you want to mock an interface using Mockito containing the following method signatures: public void doThis(Object o); public void doThis(Object... o) I need to verify that doThis(Object o) (and not the other method) has been invoked exactly one time. First I thought that the following line would do the trick: verify(mock, times(1)).doThis(anyObject()); However, as this seems to work on Windows, it doesn't on Linux because in this environment, a call to of the other doThis method is expected. This is caused because the anyObject() argument seems to match both method signatures and one