com.atlassian.crowd.test.matchers
Class GroupMatcher<E extends Group>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<E>
          extended by com.atlassian.crowd.test.matchers.GroupMatcher<E>
All Implemented Interfaces:
org.hamcrest.Matcher<E>, org.hamcrest.SelfDescribing

public class GroupMatcher<E extends Group>
extends org.hamcrest.TypeSafeMatcher<E>


Constructor Summary
GroupMatcher(org.hamcrest.Matcher<String> nameMatcher, org.hamcrest.Matcher<Boolean> activeMatcher)
           
 
Method Summary
 void describeTo(org.hamcrest.Description description)
           
static
<T extends Group>
GroupMatcher<T>
group()
          A matcher that matches any group.
static
<T extends Group>
GroupMatcher<T>
group(Class<T> type)
          A matcher that matches any group; synonymous with group() but its argument is used to set the matcher type.
static
<T extends Group>
GroupMatcher<T>
groupNamed(String name)
          A matcher that matches a group with the given name.
protected  boolean matchesSafely(E item)
           
 GroupMatcher<E> withActive(boolean active)
          Builds a new specialised matcher to match the given active status; the returned matcher will only match if all this matcher's non-group name constraints are matched AND the given status is equal to the group's active status.
 GroupMatcher<E> withNameMatching(org.hamcrest.Matcher<String> nameMatcher)
          Builds a new specialised matcher to match on group name; the returned matcher will only match if all this matcher's non-group-name constraints are matched AND the given matcher matches the group's name.
 GroupMatcher<E> withNameOf(String name)
          Builds a new specialised matcher to match the given group name exactly; the returned matcher will only match if all this matcher's non-group-name constraints are matched AND the given string is equal to the group's name.
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupMatcher

public GroupMatcher(@Nullable
                    org.hamcrest.Matcher<String> nameMatcher,
                    @Nullable
                    org.hamcrest.Matcher<Boolean> activeMatcher)
Method Detail

group

public static <T extends Group> GroupMatcher<T> group()
A matcher that matches any group.

Type Parameters:
T - type of group, to avoid casting
Returns:
a matcher which matches any group

group

public static <T extends Group> GroupMatcher<T> group(Class<T> type)
A matcher that matches any group; synonymous with group() but its argument is used to set the matcher type.

Type Parameters:
T - type of group, to avoid casting
Parameters:
type - type of group, to avoid casting (this type is not checked at runtime).
Returns:
a matcher which matches any group

groupNamed

public static <T extends Group> GroupMatcher<T> groupNamed(String name)
A matcher that matches a group with the given name.

Type Parameters:
T - type of group, to avoid casting
Returns:
a matcher which matches any group

withNameMatching

public GroupMatcher<E> withNameMatching(org.hamcrest.Matcher<String> nameMatcher)
Builds a new specialised matcher to match on group name; the returned matcher will only match if all this matcher's non-group-name constraints are matched AND the given matcher matches the group's name. Any existing group name constraint is discarded.

Parameters:
nameMatcher - matcher which must match the group's name in order for this matcher to match
Returns:
a matcher will only match if all this matcher's non-group name constraints are matched AND the given matcher matches the group's name

withNameOf

public GroupMatcher<E> withNameOf(String name)
Builds a new specialised matcher to match the given group name exactly; the returned matcher will only match if all this matcher's non-group-name constraints are matched AND the given string is equal to the group's name. Any existing group name constraint is discarded.

Parameters:
name - string which must equal the group's name in order for this matcher to match
Returns:
a matcher will only match if all this matcher's non-group name constraints are matched AND the given string is equal to the group's name

withActive

public GroupMatcher<E> withActive(boolean active)
Builds a new specialised matcher to match the given active status; the returned matcher will only match if all this matcher's non-group name constraints are matched AND the given status is equal to the group's active status. Any existing group name constraint is discarded.

Parameters:
active - the status must equal the group's status (as per Group.isActive()) in order for this matcher to match
Returns:
a matcher will only match if all this matcher's non-group name constraints are matched AND the given status is equal to the group's active status

matchesSafely

protected boolean matchesSafely(E item)
Specified by:
matchesSafely in class org.hamcrest.TypeSafeMatcher<E extends Group>

describeTo

public void describeTo(org.hamcrest.Description description)


Copyright © 2013 Atlassian. All Rights Reserved.