Hello again,
I am using verifyNoMoreInteractions() to ensure strict checking of my
mock.
I've noticed that when I do this I have to duplicate all my "when()"
calls with "verify()" calls after I run the class under test.
This smells like duplicated code. Would it be bad to have
verifyNoMoreInteractions() consider all when() calls to be mandatory,
and automatically include them.
I've created a basic example here:
http://pastebin.com/raw.php?i=kDxqjW3Z
The test class has two methods that do the same thing.
testOnlyGeneratesReportForCustomersWithWidgetsFailure - fails
because I don't include verify() calls for all my when() calls
testOnlyGeneratesReportForCustomersWithWidgetsSuccess - passes
because I include 3 extra verify calls that duplicate my when calls
It seems that verifyNoMoreInteractions() could automatically verify
that my when() expectations were satisfied and fail if they weren't.
Would anyone be surprised by that behavior?
thank you
-- James