« 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

Hey Nat,
 
I understand what you mean, in fact I expect an exception being thrown by the object under test based on the query results. Based on this using: allowing(mockReleasePackage).hasADeploymentInProgress();  will(return(true)); is effectively only used as a stub to control indirect input. I see how it can be misleading to someone reading the test, where atLeast(1).of() would be overspecification and only create noise in the test. If a change was made to the object under test so that it no longer called the stubbed method the test would fail anyways because the expected exception would no longer be thrown...
 
Thanks,
Guillaume

________________________________

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



2009/4/13 Jeudy, Guillaume <gjeudy@...>:
> allowing() passes even if the method is not called which is not what I want.

The smell is that you are expecting a query.  Why is it important that
it is called at all.  The fact that the object acts on the result the
query returned should be enough.  I would expect the  test to check
that the object causes some effects when the query returns true (or
false, or whatever), not check that it performs a query and ignore the
effects.  As someone reading the test, it appears very odd.

--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