Hey
when(foo.pushDown()).thenStateIs("down");
when(foo.pushDown()).thenStateIs("up");
I'm not sure how it fits Mockito. You would need some verification mechanism
afterwards, like verifyStates(); Also you need some constraining mechanism
for defining states :) like
when(foo.pushDown()).inState("down").thenStateIs("up");
It would be good to see a real example where it is useful.
Cheers!
Szczepan
On Sat, Apr 24, 2010 at 10:13 PM, James Carr <james.r.c
...@gmail.com> wrote:
> 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 mockito@googlegroups.com.
> To unsubscribe from this group, send email to
> mockito+unsubscribe@googlegroups.com<mockito%2Bunsubscribe@googlegroups.com >
> .
> For more options, visit this group at
> http://groups.google.com/group/mockito?hl=en.
--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to mockito@googlegroups.com.
To unsubscribe from this group, send email to mockito+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/mockito?hl=en.