Hi,
> I'm thinking about implementing this for the Mockito extension in PowerMock
Up to you ;)
>> I frequently find cases where I want to use verifyNoMoreInteractions, but
I don't think verifyNoMoreInteractions should be used frequently. It
overspecifies tests and makes them brittle. Also, one does not have to
pass all collaborators to verifyNoMoreInteractions() - just pass the
collaborators that really require strict verification (stubs usually
don't). The only problem is when the very same collaborator plays
multiple roles: you ask him for data in one interaction, you tell him
to do something in different interaction. However, usually it's a sign
of poor design. To recap: it feels the problem is elsewhere - either
in overusing of verifyNoMoreInteractions() or in poor design. I'm keen
on seeing some real code that demonstrates the need for this feature.
OTOH verifyNoMoreInteractions() might be useful for legacy code.
>> also go with verify(this.mock,
>> noMoreCalls()).myMethodIDoNotWantCalledAgain()).
I might be missing something but I don't understand this feature. Why
cannot I use verify(this.mock,
never()).myMethodIDoNotWantCalledAgain() or explicit:
verify(this.mock, times(2)).....
Cheers,
Szczepan Faber