Misplaced argument matcher detected here. You cannot use argument matchers outside of verification or stubbing in Mockito
How do Mockito matchers work?
Mockito calls real method from superclass when stubbing Mockito: List Matchers with generics Mockito stubbing void methods Matchers.any() for null value in Mockito Mockito stubbing outside of the test method Mockito using argument matchers for when call on method with variable number of arguments Modularly stubbing consecutive method calls with Mockito Stubbing a method that takes Class<T> as parameter with Mockito mockito stubbing returns null Optional stubbing in Mockito Stubbing the call of a super class method using Mockito(V 1.9.5) Mockito - Stubbing generic Class parameter Mockito mock method with comparing parameters - Misplaced argument matcher detected here Mockito 'Misplaced argument detected here' in Java Mockito - NullpointerException when stubbing Method Mockito in order verify with any matchers Cannot implement stubbing in JUnit Mockito Mockito not allowing Matchers.any() with Integer.class Mockito - Stubbing a method of an object that was returned by a mock object method Mockito Matchers any Map Mockito - deep stubbing Stubbing defaults in Mockito Mockito varargs Invalid use of argument matchers Unfinished Stubbing Detected in Mockito Stubbing Out a Null-Returning Function in Mockito Invalid use of argument matchers Mockito Matchers.any(...) on one argument only Why am I getting Mockito misplaced argument matcher detected here with anyInt()? JMockit: "Misplaced argument matcher detected here" when mocking an interface