ollie314 / hamcrest

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

Should mismatchDescription really be matchedValueDescription? #72

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
While looking at Issue 71, I realised that we can't generate a good not() 
message because 
mismatchDescription might only be filled in when there's actually a mismatch. 

Have we got this wrong? Are we actually interested in having a description of 
the candidate matched 
value whether it succeeds or not?

Original issue reported on code.google.com by smgfree...@gmail.com on 3 Mar 2009 at 9:45

GoogleCodeExporter commented 8 years ago
Ah, I see your point. The DiagnosingMatchers report what they find not to 
match, but
that doesn't work if another matcher wraps the DiagnosingMatcher and inverts 
the logic.

It seems like the inner matcher would have to know about the inversion in order 
to
make an appropriate mismatch description. And outside of the diagnosing 
matchers,
you're just getting the whole match candidate without any details about what
specifically didn't match. (In some cases this works fine, as for IsInstanceOf, 
which
is what I was trying to make work yesterday, but not so much for collection or
feature matchers.)

Sorry, no suggestions.

Original comment by mhack...@kanayo.com on 3 Mar 2009 at 3:20

GoogleCodeExporter commented 8 years ago
See my comment on http://code.google.com/p/hamcrest/issues/detail?id=71.  It is 
possible, and potentially quite easy to do.

Original comment by stephen....@gmail.com on 26 Mar 2009 at 10:15

GoogleCodeExporter commented 8 years ago
tagging

Original comment by t.denley on 12 May 2012 at 11:00