Class GroupMatcher<E extends Group>

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<E>
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 Details

    • GroupMatcher

      public GroupMatcher(@Nullable org.hamcrest.Matcher<String> nameMatcher, @Nullable org.hamcrest.Matcher<Boolean> activeMatcher, @Nullable org.hamcrest.Matcher<Long> directoryIdMatcher)
  • Method Details

    • 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)
      Parameters:
      nameMatcher - matcher which must matcher the group's name in order for the new matcher to match
      Returns:
      a new matcher which will only match if all this matcher's non-name constraints are matched AND the given name matches
    • withNameOf

      public GroupMatcher<E> withNameOf(String name)
      Parameters:
      name - string which must equal the group's name in order for the new matcher to match
      Returns:
      a new matcher which will only match if all this matcher's non-name constraints are matched AND the given name matches
    • withActive

      public GroupMatcher<E> withActive(boolean active)
      Parameters:
      active - the status must equal the group's status (as per Group.isActive()) in order for the new matcher to match
      Returns:
      a new matcher which will only match if all this matcher's non-active constraints are matched AND the given active matches
    • withDirectoryId

      public GroupMatcher<E> withDirectoryId(long directoryId)
      Parameters:
      directoryId - the directory id must equal the group's directory id in order for the new matcher to match
      Returns:
      a new matcher which will only match if all this matcher's non-directoryId constraints are matched AND the given directoryId matches
    • 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)