mensahs / mockito

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

Suggestion:hope Matcher.any(java.lang.Class<T> clazz) do what it declared #366

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here,in this method,the type checking is definitely needed.In some cases,Work 
around can be easy to found,but not elegant,and many other cases,it is hard to 
do work ground,and cost bunch of thinking and time.

Original issue reported on code.google.com by Alexande...@gmail.com on 15 Aug 2012 at 4:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, you should look at the matcher 'isA'.

Unfortunately this isn't gonna happen soon, the javadoc has been updated to 
document there is no type checks there.

I remember having this discussion in another issue. Not sure when and which 
issue though.

Cheers,
Brice

Original comment by brice.du...@gmail.com on 20 Aug 2012 at 1:22

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 6 Sep 2012 at 3:43

GoogleCodeExporter commented 8 years ago
I think we need to do it. Many people use this matcher and think it's doing 
something else than it's actually doing :) Let's introduce this breaking change 
in 2.0.

Original comment by szcze...@gmail.com on 18 Sep 2012 at 9:02

GoogleCodeExporter commented 8 years ago
ok then, we should replace it by

reportMatcher(new InstanceOf(clazz)).<T>returnFor(clazz);

However I'm wondering if you should introduce type checks for the other methods 
of the any.* family (but any()/anyObject) ? For example 'anyString' is using 
the 'Any' matcher.

Original comment by brice.du...@gmail.com on 19 Sep 2012 at 2:09

GoogleCodeExporter commented 8 years ago
Good point. We should.

Original comment by szcze...@gmail.com on 20 Sep 2012 at 6:23

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 27 Sep 2012 at 2:26

GoogleCodeExporter commented 8 years ago
yay!

Original comment by kandpwel...@gmail.com on 31 Oct 2012 at 7:57