mr-sun / hamcrest

Hamcrest matchers for c++ (using with carnamock)
0 stars 0 forks source link

AllOf does not output mismatch description #179

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Tested with 1.3.RC2

I'm not sure what the purpose of DiagnosticMatcher is, but it causes the 
mismatch description to be lost since it is output to a NullDescription.  Test 
case: https://gist.github.com/2328494

Original issue reported on code.google.com by hertzsprung on 7 Apr 2012 at 12:40

GoogleCodeExporter commented 8 years ago
Please check your build, when I try this I get

java.lang.AssertionError: 
Expected: (a value greater than <3> and a value less than <5>)
     but: was <2>

Also, this is a combinable matcher, not AllOf

Original comment by smgfree...@gmail.com on 28 Apr 2012 at 2:58

GoogleCodeExporter commented 8 years ago
What I was expecting was for the greaterThan() matcher to generate diagnostics, 
like this:
java.lang.AssertionError: 
Expected: (a value greater than <3> and a value less than <5>)
     but: <2> was less than <3>

I've found this problematic when making assertions on beans.  For example 
https://gist.github.com/2330108 gives the diagnostics:
java.lang.AssertionError: 
Expected: (hasProperty("status", (a value equal to or greater than <400> and a 
value less than <500>)) and hasProperty("entity", "actualEntity"))
     but: was <com.sun.jersey.core.spi.factory.ResponseImpl@4c95fa7f>

Original comment by hertzsprung on 28 Apr 2012 at 3:32

GoogleCodeExporter commented 8 years ago
Two requests: 
- can you try this with the latest version from the github repository? That 
code might have changed.
- can you provide an example with no depedencies to make it easier to run?

Thanks

S

Original comment by smgfree...@gmail.com on 29 Apr 2012 at 11:00

GoogleCodeExporter commented 8 years ago
Figured this one out. Combinable matcher was not self diagnosing. Fixed in HEAD

Original comment by smgfree...@gmail.com on 29 Apr 2012 at 11:23

GoogleCodeExporter commented 8 years ago
The fix works for me, too.  Thanks!

Original comment by hertzsprung on 29 Apr 2012 at 11:49