mlinhard / mockito

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

Report improper usage of ArgumentMatcher #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
MyObject o = new MyObject();
o.setName(any(String.class)); 
// invoke some mocked object

What is the expected output? What do you see instead?
Expected:
An exception because of improper usage of argument matchers.

Observed:
1.8.5 does not react at all.
1.9.0 will throw an InvalidUseOfMatchersException on interaction with a 
Mock-object later on. However, this Exception than occurs out of context and 
does not indicate what actually went wrong.

What version of the product are you using? On what operating system?
1.9.0

Original issue reported on code.google.com by frank.sc...@gmail.com on 3 Jan 2012 at 10:17

GoogleCodeExporter commented 9 years ago
We can't throw the exception sooner. However it *might* be possible to report 
this misusage with more information.

Original comment by brice.du...@gmail.com on 3 Jan 2012 at 10:39

GoogleCodeExporter commented 9 years ago
That's right, we're throwing the exception as soon as we can. Doesn't the 
exception message contain the clickable stack trace element to the offending 
line of code?

Original comment by szcze...@gmail.com on 3 Jan 2012 at 11:19

GoogleCodeExporter commented 9 years ago
I don't think the location of all matcher are displayed right now. I think 
that's what Frabk meant.

Original comment by brice.du...@gmail.com on 3 Jan 2012 at 11:38

GoogleCodeExporter commented 9 years ago
Oh I see. Then we should try to reproduce it and fix :)

Original comment by szcze...@gmail.com on 4 Jan 2012 at 12:48

GoogleCodeExporter commented 9 years ago
Fixed in revision b2492408a10c
Thx to Julien Meddah for the Contribution

Original comment by brice.du...@gmail.com on 9 Mar 2012 at 9:28

GoogleCodeExporter commented 9 years ago

Original comment by szcze...@gmail.com on 13 May 2012 at 3:37

GoogleCodeExporter commented 9 years ago

Original comment by szcze...@gmail.com on 3 Jun 2012 at 2:06

GoogleCodeExporter commented 9 years ago

Original comment by brice.du...@gmail.com on 2 Dec 2012 at 10:21