I recently finished up Steve and Nat's book and on thing of interest
that he introcduced was using the concept of states
(
http://www.jmock.org/states.html) rather than verifying interactions
occur in order. Essentially, when different interactions occur you can
say that the object is in a certain "state" and then verify that
state. This makes a lot of sense for the same reasons I never ever use
the InOrder verifications in mockito... in my experience InOrder
verifications either indicate some very procedural logic or in the
cases where it might seem to be relevant the tests produced with it
are often very brittle.
After seeing several examples of "state" based verification, I like it
and I keep thinking... how could we introduce a similar feature in
mockito? As another method tacked on to givne/when maybe? Something
like
when(foo.pushDown()).thenStateIs("down");
when(foo.pushDown()).thenStateIs("up");
or
given(foo.pushDown()).thenStateIs("down");
given(foo.pushDown()).thenStateIs("up");
Just a thought.
Thanks,
James
--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to
moc...@googlegroups.com.
To unsubscribe from this group, send email to
mockito+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mockito?hl=en.