This exception may occur if matchers are combined with raw values

时间:2022-01-10 15:14:13

org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
3 matchers expected, 2 recorded:
-> at com.FilterDeviceReplaceTest.init(FilterDeviceReplaceTest.java:41)
-> at com.FilterDeviceReplaceTest.init(FilterDeviceReplaceTest.java:46)

This exception may occur if matchers are combined with raw values:
    //incorrect:
    someMethod(anyObject(), "raw String");
When using matchers, all arguments have to be provided by matchers.
For example:
    //correct:
    someMethod(anyObject(), eq("String by matcher"));

For more info see javadoc for Matchers class.