Problem: When JUnit in Java returns next error:
This exception may occur if matchers are combined with raw values:
//incorrect:
someMethod(any(), "raw String");
When using matchers, all arguments have to be provided by matchers.
For example:
//correct:
someMethod(any(), eq("String by matcher"));
Solution: You have are using any() or anyString() or something similar to mock a method parameter. All the parameters of that method have to use any(), anyString()… And if you want to specify some values, you have to use eq().
Example:
//incorrect: because we are not using eq(...) in the parameter where we want to specify the value
when(...).methodName("concrete_value", any(<classType>.class)).thenReturn(...);
//correct: in all parameters we are using any(), eq(), anyString()...
when(...).methodName(eq("concrete_value"), any(<classType>.class)).thenReturn(...);
For more interesting tutorials & guides just check them HERE.