Hi,
I have been using jmock 2 for a little while now. I would like to know is it possible to ignore all method calls to a particular mock except for certain expectations? For example I have:
mockContext
.checking(new Expectations() {
{
ignoring(mockReleasePackage).getReleasePackageNm();
ignoring(mockReleasePackage).getId();
ignoring(mockReleasePackage).isFrozen();
ignoring(mockReleasePackage).getLatestDeployment();
ignoring(deploymentMgtService);
one(mockReleasePackage).hasADeploymentInProgress(); will(returnValue(true));
}
});
That above sample works but I believe will make the test more brittle to changes and seems like it is overspecified. I tried doing something like that: but the ignoring() call seems to take precedence and therefore the test does not give expected results.
mockContext.checking(new
Expectations() {
{
ignoring(mockReleasePackage);
ignoring(deploymentMgtService);
one(mockReleasePackage).hasADeploymentInProgress(); will(returnValue(true));
}
});
Thanks,
Guillaume Jeudy
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.