You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Robert Munteanu (JIRA)" <ji...@apache.org> on 2016/02/11 10:52:18 UTC

[jira] [Comment Edited] (SLING-5508) Provide additional Hamcrest matchers

    [ https://issues.apache.org/jira/browse/SLING-5508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15142479#comment-15142479 ] 

Robert Munteanu edited comment on SLING-5508 at 2/11/16 9:51 AM:
-----------------------------------------------------------------

[~kwin] - changes look good to me, thank you!

While we're at it, could we discuss the names of the ResourceMatchers methods which make assertions related to the resource's children? We did not have a release yet so we can tweak them.

I think there's isn't a lot of difference between {{hasChildren}} and {{containsChildren}} , so maybe we can make the difference in behaviour clearer in the method names. Some ideas come to mind:

- containsChildren / containsChildrenExclusively / containsChildrenInAnyOrder
- containsSomeChildren / containsChildren / containsChildrenInAnyOrder
- containsChildren / containsAllChildren / containsAllChildrenInOrder

I also considered a variant with Enum flags , e.g.

{code}
enum ChildLookupFlag {
  MUST_MATCH_ALL, MUST_ENFORCE_ORDER;
}
{code}

but since we already use var-arg parameter we can't overload this in a meaningful way.


was (Author: rombert):
[~kwin] - changes look good to me, thank you!

While we're at it, could we discuss the names of the ResourceMatchers methods which make assertions related to the resource's children? We did not have a release yet so we can tweak them.

I think there's isn't a lot of difference between {{hasChildren}} and {{containsChildren}} , so maybe we can make the difference in behaviour clearer in the method names. Some ideas come to mind:

- containsChildren / containsChildrenExclusively / containsChildrenInAnyOrder
- containsSomeChildren / containsChildren / containsChildrenInAnyOrder

I also considered a variant with Enum flags , e.g.

{code}
enum ChildLookupFlag {
  MUST_MATCH_ALL, MUST_ENFORCE_ORDER;
}
{code}

but since we already use var-arg parameter we can't overload this in a meaningful way.

> Provide additional Hamcrest matchers
> ------------------------------------
>
>                 Key: SLING-5508
>                 URL: https://issues.apache.org/jira/browse/SLING-5508
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: Apache Sling Testing Hamcrest 1.0.0
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>             Fix For: Apache Sling Testing Hamcrest 1.0.0
>
>
> Currently the Hamcrest matchers provided in SLING-5063 only can match for some of the child names. An exact match is missing. Desired would be methods like 
> # {{ResourceMatchers.containsChildren}}
> # {{ResourceMatchers.containsChildrenInAnyOrder}}
> similar to {{Matcher.contains}} and {{Matchers.containsInAnyOrder}}
> In addition it would be good to have a matcher on just a single resource for a given name like {{ResourceMatchers.resourceWithName}} and also a combination of the name matcher with the property matcher ({{ResourceMatchers.resourceWithNameAndProps}})



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