dhamini-poornachandra / mockito

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

Weird InvalidUseOfMatchersException exception on mock object. #412

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Running the Scratch2.java file produces a wired InvalidUseOfMatchersException

What is the expected output? What do you see instead?

The call to the mock should have no effect. 

What version of the product are you using? On what operating system?
Mockito 1.9.5 on eclipse

Please provide any additional information below.

Original issue reported on code.google.com by Sidha...@knewton.com on 21 Jan 2013 at 7:38

Attachments:

GoogleCodeExporter commented 8 years ago
Ok so here is a quick summary on stack overflow.. This definitely looks like a 
bug.. 
http://stackoverflow.com/questions/14434402/wierd-mockito-invaliduseofmatchersex
ception-when-calling-mock-from-some-method/14434481#14434481

Original comment by Sidha...@knewton.com on 21 Jan 2013 at 8:00

GoogleCodeExporter commented 8 years ago
Hi,

Mockito is right you are using a mockito matcher on a non mock object at line 
37 
(http://code.google.com/p/mockito/issues/attachmentText?id=412&aid=4120000000&na
me=Scratch2.java&token=K_0cxKdBSzHh7NtpsrTc6G1nnfE%3A1359384487617#37) : 

c.run(Mockito.any(Foo.class));

Where 'c' instance is not a mock but a real instance.

Original comment by brice.du...@gmail.com on 28 Jan 2013 at 2:50