Closed lkysow closed 6 years ago
I'm not sure I understand this one. Are you asking for something like this:
When(contactList.getContactByFullName("Dan", AnyString())).thenReturn(Contact{...})
If so, that's unfortunately not possible with the current syntax. It's a technical limitation defined by how the framework works. It simply wouldn't know afterwards which matcher should go to which parameter.
That's why the only way to do this is through:
When(contactList.getContactByFullName(EqString("Dan"), AnyString())).thenReturn(Contact{...})
Yes, that's what I'm asking for. I figured there was a very good reason why we couldn't accomplish it but maybe we could keep this open to see if someone can find a way?
@lkysow OK, yes, makes sense. I'm definitely open for suggestions. I haven't even thought about this one, because Mockito which I borrowed most of the syntax from has also not solved this one. But again, I'm open for suggestions.
I think that given the Eq
matchers are autogenerated this isn't really an issue any more so you could close?
Agree, let's close it for now. And I'll keep in the back of my head and am in general happy to re-open this when someone has a good idea to accomplish this.
I often want to mix Any matchers (ex.
AnyString()
) with specific matchers ex.foo
.