Java Mailing List Archive

Home » user.jmock »

[jmock-user] expects returns a default value for void return type

Ashutosh Kumar


Replies: Find Java Web Hosting

Author LoginPost Reply

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@16672d6>)


  allowed, never invoked: brmUserBo.saveUser(<com.arisglobal.agBRM.user.entity.BrmUser@16672d6>); returns a default value


Here is my test :


public void testsaveUsers() {

            try {

                  final  Mockery context = new  JUnit4Mockery()  {{



                  final BrmUserBoImpl userBo = context.mock(BrmUserBoImpl.class);

                  final BrmUser user = new BrmUser();

                  BrmUserServiceImpl userService = new BrmUserServiceImpl();


                  context.checking(new Expectations() {







            } catch (Exception e) {




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.

©2008 - Jax Systems, LLC, U.S.A.