Class CollectionOneToOneMatcher<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 CollectionOneToOneMatcher<T>
    extends ElementMatcher.Junction.AbstractBase<java.lang.Iterable<? extends T>>
    An element matcher that matches a given iterable collection to a list of matchers on a per-element basis. For a successful match, any element of the matched iterable collection must be successfully matched by a next matcher of the supplied list of element matchers. For this to be possible, the matched iterable collection and the supplied list of element matchers contain the same number of elements.
    • Field Detail

      • matchers

        private final java.util.List<? extends ElementMatcher<? super T>> matchers
        The list of element matchers to match any elements of the matched iterable collection against.
    • Constructor Detail

      • CollectionOneToOneMatcher

        public CollectionOneToOneMatcher​(java.util.List<? extends ElementMatcher<? super T>> matchers)
        Creates a new matcher that compares a matched iterable collection against a list of element matchers.
        Parameters:
        matchers - The list of element matchers to match any elements of the matched iterable collection against.
    • 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