What is the correct way to use Mockito’s generic any()
method instead of anyObject()
?
I have an interface with a method that expects an array of Foo
:
public interface IBar {
void doStuff(Foo[] arr);
}
I am mocking this interface using Mockito, and I want to verify that doStuff()
is called, but I don’t care what arguments are passed.
How can I rewrite the following code using any()
, the generic method, instead of anyObject()
?
IBar bar = mock(IBar.class);
...
verify(bar).doStuff((Foo[]) anyObject());