You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2016/02/03 16:38:39 UTC

[jira] [Resolved] (SLING-5481) Improve the Sling Hamcrest Matchers mismatch message

     [ https://issues.apache.org/jira/browse/SLING-5481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konrad Windszus resolved SLING-5481.
------------------------------------
    Resolution: Fixed

Fixed in [r1728333|http://svn.apache.org/r178333].

Now the messages look like this:

{quote}
Expected: Resource with children ["child1"]
     but: was Resource with children ["child2","child3"] (resource: <MergedResource [path=/merged, resources=[Ljava.lang.String;@13a709f1]>)
{quote}
or
{quote}
Expected: Resource with properties [<some property=some value>]
     but: was Resource with properties [<some other property=some other value>] (resource: <MergedResource [path=/merged, resources=[Ljava.lang.String;@283e07bd]>)
{quote}

It still includes the original toString() representation but in addition always either all properties or all child names.

> Improve the Sling Hamcrest Matchers mismatch message
> ----------------------------------------------------
>
>                 Key: SLING-5481
>                 URL: https://issues.apache.org/jira/browse/SLING-5481
>             Project: Sling
>          Issue Type: Improvement
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>             Fix For: Apache Sling Testing Hamcrest 1.0.0
>
>
> Currently both hamcrest matchers added in SLING-5063 rely on the resource's {{toString()}} method to print out the comparison value.
> An example mismatch might look like this
> {quote}
> Expected: Resource with children ["child1"]
>      but: was <MergedResource [path=/merged, resources=[Ljava.lang.String;@1875b888]>
> {quote}
> It would be nice to tweak the mismatch error message by overwriting the {{describeMismatchSafely}} method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)