TypeSafeMatcher could give more information about failed matches
wolever opened this issue · 1 comments
wolever commented
I just spent half an hour debugging a matcher which was failing because I was trying to give the IsArrayContaining matcher an ArrayCollection instead of an array. The error message I got was:
Expected: Array containing "foo"
But got: <"foo", "bar", "baz">
It would be more helpful if I was to get some indication that the failure was a result of the type checking. For example:
Expected: Array containing "foo"
But got: [ArrayCollection <"foo", "bar", "baz">]
drewbourne commented
Indeed it should give a better error message in this situation.
I have had a niggling feeling that the TypeSafeMatcher should be deprecated and its usage replaced with TypeSafeDiagnosingMatcher so that it is always possible to give a better description for a mismatch.