I'm using mockito-core:2.8.47 and Java 7 and want to use in a when and verify anyListOf or some other any method.
My Problem is, if I just use anyList it says:
The method name( int, List < List < String > >) in the type Y is not
applicable for the arguments ( int, List < Object > )
How can I fix this?
ArgumentMatchers.anyListOf(ArgumentMatchers.anyListOf( String.class ) ) doesn't work...
In my opinion you can get away with just the basic
anyList()method with additional generics information:This worked for me and also remember to add the
ArgumentMatcherfor the first int variable otherwise Mockito will fail.