Class CollectionItemMatcher<T>

  • Type Parameters:
    T - The type of the matched entity.
    All Implemented Interfaces:
    ElementMatcher<java.lang.Iterable<? extends T>>, ElementMatcher.Junction<java.lang.Iterable<? extends T>>

    @Enhance
    public class CollectionItemMatcher<T>
    extends ElementMatcher.Junction.AbstractBase<java.lang.Iterable<? extends T>>
    A list item matcher matches any element of a collection to a given matcher and assures that at least one element matches the supplied iterable condition.
    • Field Detail

      • matcher

        private final ElementMatcher<? super T> matcher
        The element matcher to apply to each element of a collection.
    • Constructor Detail

      • CollectionItemMatcher

        public CollectionItemMatcher​(ElementMatcher<? super T> matcher)
        Creates a new matcher that applies another matcher to each element of a matched iterable collection.
        Parameters:
        matcher - The element matcher to apply to each element of a iterable collection.
    • Method Detail

      • matches

        public boolean matches​(java.lang.Iterable<? extends T> target)
        Matches a target against this element matcher.
        Parameters:
        target - The instance to be matched.
        Returns:
        true if the given element is matched by this matcher or false otherwise.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object