« Return to Thread: Ignore all methods except for one call

RE: Ignore all methods except for one call

by Guillaume Jeudy :: Rate this Message:

Reply to Author | View in Thread

Thanks Steve and Nat,
 
allowing() passes even if the method is not called which is not what I want. But you are right the test should still pass if hasADeploymentInProgress() is called more than once. Therefore using atLeast(1).of(mockReleasePackage) should fulfill my needs.
 
-Guillaume

________________________________

From: Nat Pryce [mailto:nat.pryce@...]
Sent: Mon 4/13/2009 12:01 PM
To: user@...
Subject: Re: [jmock-user] Ignore all methods except for one call



2009/4/13 Steve Freeman <steve@...>:
> Yes. We used to have more complex search options but it was too confusing,
> so now it's first-to-last.
>
> We should write this up more clearly...

It's documented here: http://www.jmock.org/dispatch.html

>> I found how to do it. The order in which expectations are set is
>> important. If I put ignoring() at the end it will only get there if any
>> previous expectations didnt match.

Yes, but it will also get there if hasADeploymentInProcess() is called
more than once which does not appear to be what you want.

It seems odd, to me, that you are expecting a *query* once, and
ignoring commands.  Why is it important that the object under test
only calls hasADeploymentInProgress once?  Why not just allow that to
return true and ignore everything else (in which case, putting the
ignoring(mockReleasePackage); call last *will* do what you want).

--Nat

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email







____________________________________________________________________________________________________
This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

winmail.dat (6K) Download Attachment

 « Return to Thread: Ignore all methods except for one call