RE: expects returns a default value for void return type
I am using 2.5.1 . It does not create any thread. Implementation classes use spring for dependency injection.
Thanks
Ashutosh
From: Fedor Bobin [mailto:fuudtorrentsru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: Tuesday, September 13, 2011 10:45 AM
To: user-sXN/XchZ9OexIXFVlbCvtR2eb7JE58TQ@public.gmane.org
Subject: Re: [jmock-user] expects returns a default value for void return type
What jmock version do you use?
Is userService.saveUser() create or use threads?
2011/9/13 Ashutosh Kumar <Ashutosh.Kumar-YELz9hDmLZ5yjigaA7mwwQ@public.gmane.org>
I have a method which returns void . However when I run the test I get error stating
java.lang.AssertionError: unexpected invocation: brmUserBo.saveUser(<com.arisglobal.agBRM.user.entity.BrmUser <at> 16672d6>)
expectations:
allowed, never invoked: brmUserBo.saveUser(<com.arisglobal.agBRM.user.entity.BrmUser <at> 16672d6>); returns a default value
Here is my test :
public void testsaveUsers() {
try {
final Mockery context = new JUnit4Mockery() {{
setImposteriser(ClassImposteriser.INSTANCE);
}};
final BrmUserBoImpl userBo = context.mock(BrmUserBoImpl.class);
final BrmUser user = new BrmUser();
BrmUserServiceImpl userService = new BrmUserServiceImpl();
userService.setBrmUserBo(userBo);
context.checking(new Expectations() {
{
allowing(userBo).saveUser(user);
}
});
userService.saveUser(user);
} catch (Exception e) {
fail();
}
}
Disclaimer: This transmission, including attachments, is confidential, proprietary, and may be privileged. It is intended solely for the intended recipient. If you are not the intended recipient, you have received this transmission in error and you are hereby
advised that any review, disclosure, copying, distribution, or use of this transmission, or any of the information included therein, is unauthorized and strictly prohibited. If you have received this transmission in error, please immediately notify the sender
by reply and permanently delete all copies of this transmission and its attachments.
Disclaimer: This transmission, including attachments, is confidential, proprietary, and may be privileged. It is intended solely for the intended recipient. If you are not the intended recipient, you have received this transmission in error and you are hereby advised that any review, disclosure, copying, distribution, or use of this transmission, or any of the information included therein, is unauthorized and strictly prohibited. If you have received this transmission in error, please immediately notify the sender by reply and permanently delete all copies of this transmission and its attachments.
RSS Feed