Reputation: 1260
I need to write the following assert statement:
verify(tp, never()).addEvent(eventOfTypeA);
It should fail when addEvent is invoked, but only if it is invoked only with a TypeAEvent as parameter. I also tried:
verify(tp, never()).addEvent((TypeAEvent) any());
but it doesn't work.
I know that that I can set a captor, get all events given as parameters and then check each of them using instanceOf(), but I think that is an ugly solution. Any ideas?
Upvotes: 0
Views: 42
Reputation: 31
Try using
verify(tp, never()).addEvent(Matchers.any(TypeAEvent.class));
Upvotes: 0