nanoSK
unread,Mar 20, 2009, 6:49:56 AM3/20/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mockito
Hello there,
the following method is given:
public Set<GUICommand> getCommandsByGroups(final Class<? extends View>
viewClass, final CommandGroup... commandGroups)
Since I do not care about the commandGroups given I'd like to do the
following verification:
Mockito.verify(myMock).getCommandsByGroups(Mockito.eq
(AdditionalCostTypeMDView.class), Mockito.any????));
Which matcher can I use/implement for the commandGroups parameter?
I've been trying various matchers, i.e.
class CommandGroupArrayMatcher extends ArgumentMatcher<CommandGroup[]
> {
@Override
public boolean matches(Object argument) {
return true;
}
}
But this does not work:
org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 1 matchers expected, 2 recorded. <<<<<<<<<<<<<<<<<<<<<
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.
Why does Mockito expect just one matcher?
Any help?