Ashutosh Kumar | 13 Sep 2011 07:16
Picon

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.

Ashutosh Kumar | 13 Sep 2011 09:46
Picon

Re: expects returns a default value for void return type

Probably it is happening with transactional methods. Do I need to do something extra for transactional methods?
 
Thanks
Ashutosh

On Tue, Sep 13, 2011 at 10:46 AM, Ashutosh Kumar <Ashutosh.Kumar-YELz9hDmLZ5yjigaA7mwwQ@public.gmane.org> wrote:

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 <at> jmock.codehaus.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-YELz9hDmLZ4WUB6XyBwvMA@public.gmane.orgin>

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.


Fedor Bobin | 13 Sep 2011 09:51
Picon

Re: expects returns a default value for void return type

May be you can separate test and some classes so we can discover what is wrong.

2011/9/13 Ashutosh Kumar <ashutosh.k78 <at> gmail.com>
Probably it is happening with transactional methods. Do I need to do something extra for transactional methods?
 
Thanks
Ashutosh

On Tue, Sep 13, 2011 at 10:46 AM, Ashutosh Kumar <Ashutosh.Kumar-YELz9hDmLZ5yjigaA7mwwQ@public.gmane.org> wrote:

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 <at> jmock.codehaus.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-YELz9hDmLZ4WUB6XyBwvMA@public.gmane.orgin>

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.



Fedor Bobin | 13 Sep 2011 07:23
Picon

Re: expects returns a default value for void return type

Is equals in BrmUser correct?

2011/9/13 Ashutosh Kumar <Ashutosh.Kumar-YELz9hDmLZ5yjigaA7mwwQ@public.gmane.org>

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 <at> jmock.codehaus.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-YELz9hDmLZ4WUB6XyBwvMA@public.gmane.orgin>

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.


Riazuddin Mohideen | 26 Sep 2011 18:42

Re: expects returns a default value for void return type

if this is not solved yet then use the following code after "userService.saveUser(user);"

context.assertIsSatisfied();

-Riaz




From:        Fedor Bobin <fuudtorrentsru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To:        user-sXN/XchZ9OexIXFVlbCvtR2eb7JE58TQ@public.gmane.org
Date:        09/13/2011 11:59 AM
Subject:        Re: [jmock-user] expects returns a default value for void return type



Is equals in BrmUser correct?

2011/9/13 Ashutosh Kumar <Ashutosh.Kumar <at> arisglobal.co.in>
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 :

 

publicvoidtestsaveUsers() {

            try{

                  final  Mockery context = new  JUnit4Mockery()  {{

                    setImposteriser(ClassImposteriser.INSTANCE);

                }};

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

                  finalBrmUser user = newBrmUser();

                  BrmUserServiceImpl userService = newBrmUserServiceImpl();

                  userService.setBrmUserBo(userBo);

                  context.checking(newExpectations() {

                        {

                              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.



**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**

Gmane