hamcrest-as3 icon indicating copy to clipboard operation
hamcrest-as3 copied to clipboard

TypeSafeMatcher could give more information about failed matches

Open wolever opened this issue 16 years ago • 1 comments

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">]

wolever avatar Aug 28 '09 17:08 wolever

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.

drewbourne avatar Aug 30 '09 09:08 drewbourne