expects returns a default value for void return type
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.
RSS Feed