Class AttributesMatcher<E extends Attributes>

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

public class AttributesMatcher<E extends Attributes> extends org.hamcrest.TypeSafeMatcher<E>
Matcher for any Crowd entity with attributes.
  • Method Details

    • entityWithAttributes

      public static <T extends Attributes> AttributesMatcher<T> entityWithAttributes()
      A matcher that matches any entity.
      Type Parameters:
      T - type of entity, to avoid casting
      Returns:
      a matcher which matches any entity
    • entityWithAttributes

      public static <T extends Attributes> AttributesMatcher<T> entityWithAttributes(Class<T> type)
      A matcher that matches any entity with attributes; synonymous with entityWithAttributes() but its argument is used to set the matcher type.
      Type Parameters:
      T - type of entity, to avoid casting
      Parameters:
      type - type of entity, to avoid casting (this type is not checked at runtime).
      Returns:
      a matcher which matches any entity
    • withNoAttributes

      public AttributesMatcher<E> withNoAttributes()
      Builds a new specialised matcher that matches entities with no attributes. Any existing constraint is discarded.
    • hasEntry

      public AttributesMatcher<E> hasEntry(org.hamcrest.Matcher<? super String> keyMatcher, org.hamcrest.Matcher<? super Set<String>> valueMatcher)
      Builds a new specialised matcher that matches entities with at least an attribute that matches simultaneously the key and value matchers. Any existing constraint is discarded.
    • hasEntry

      public AttributesMatcher<E> hasEntry(String key, String singleValue)
      Builds a new specialised matcher that matches entities with at least an attribute that has the given key and singleton value. Any existing constraint is discarded.
    • doesNotHaveKey

      public AttributesMatcher<E> doesNotHaveKey(String key)
      Builds a new specialised matcher that matches entities that do not have a particular attribute key. Any existing constraint is discarded.
    • matchesSafely

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

      public void describeTo(org.hamcrest.Description description)