Class Matchers

    • Method Detail

      • subclassOf

        public static Matcher<Class<?>> subclassOf​(Class<?> klazz)
        Returns a matcher that matches classes that are sub-types of the supplied class.
        Parameters:
        klazz - a potential super-type
        Returns:
        a Class<?> matcher
      • hasAttribute

        public static Matcher<Map<String,​Object>> hasAttribute​(String key,
                                                                     Object value)
        Returns a matcher that matches attribute maps that include the given attribute entry.
        Parameters:
        key - attribute name
        value - attribute value
        Returns:
        a Map<String, Object> matcher
      • hasAttribute

        public static Matcher<Map<String,​Object>> hasAttribute​(String key,
                                                                     Matcher<? extends Object> value)
        Returns a matcher that matches attribute maps the include an attribute with the given name, and whose value matches the given matcher.
        Parameters:
        key - attribute name
        value - attribute value matcher
        Returns:
        a Map<String, Object> matcher
      • anyOf

        @SafeVarargs
        public static <T> Matcher<T> anyOf​(Matcher<? super T>... matchers)
        Returns a matcher that matches when against objects which match any of the supplied matchers.
        Type Parameters:
        T - type of the object to be matched
        Parameters:
        matchers - list of matchers to match
        Returns:
        a compound matcher
      • allOf

        @SafeVarargs
        public static <T> Matcher<T> allOf​(Matcher<? super T>... matchers)
        Returns a matcher that matches when against objects which match all of the supplied matchers.
        Type Parameters:
        T - type of the object to be matched
        Parameters:
        matchers - list of matchers to match
        Returns:
        a compound matcher