rysang / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Verify using value returned from stubbed method fails to detect missing call #254

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. See attached test case.

What is the expected output? What do you see instead?
Using verify() to verify a method call that uses the value returned from a stub 
should fail if the method call does not occur. 

In the test case, the following fails to detect a missing call to 
foo.setVersion():

   verify(foo).setVersion(versionUpdate.getVersion());

However, the following (also in the test case) successfully detects the missing 
call by assigning the value returned from the stub to an intermediate variable:

   final IVersion expectedVersion = versionUpdate.getVersion();
   verify(foo).setVersion(expectedVersion);

There seems to be some strange interaction between the evaluation of the stub 
and the verification that prevents verify() from detecting the missing call.

What version of the product are you using? On what operating system?
Mockito 1.8.4, Windows 7 64-bit.

Please provide any additional information below.

Original issue reported on code.google.com by Stuart.w...@i2group.com on 5 Apr 2011 at 12:13

Attachments:

GoogleCodeExporter commented 8 years ago
Isnt it a duplicate of issue 138? If so then upgrade mockito version and stay 
happy ;)

Original comment by szcze...@gmail.com on 7 Apr 2011 at 8:19

GoogleCodeExporter commented 8 years ago
Yes, it looks like it -- I've just tested with version 1.8.5 and can confirm 
that it's fixed.

Many thanks for the excellent support!

Cheers,
Stu

Original comment by Stuart.w...@i2group.com on 7 Apr 2011 at 9:20

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 7 Apr 2011 at 7:34