Invalid use of arguments! 0 expected matches, 1 entry
Although the error is rather descriptive, I could not see it. For lines:
PowerMockito.when(
mockStringMessageService.lookupString(Matchers.eq("XYZ")))
.thenReturn(Matchers.eq("XYZ"));
Mistake:
[junit] Invalid use of argument matchers!
[junit] 0 matchers expected, 1 recorded:
[junit] -> at com.amazon.kilvish.types.StatusTableTest.setUp(StatusTableTest.java:61)
[junit]
[junit] This exception may occur if matchers are combined with raw values:
[junit] //incorrect:
[junit] someMethod(anyObject(), "raw String");
[junit] When using matchers, all arguments have to be provided by matchers.
[junit] For example:
[junit] //correct:
[junit] someMethod(anyObject(), eq("String by matcher"));
[junit]
[junit] For more info see javadoc for Matchers class.
Why are 0 matches expected?
+3
source to share