Class CollectionOneToOneMatcher<T>

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

@Enhance public class CollectionOneToOneMatcher<T> extends ElementMatcher.Junction.ForNonNullValues<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 Details

    • matchers

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

    • CollectionOneToOneMatcher

      public CollectionOneToOneMatcher(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 Details

    • doMatch

      protected boolean doMatch(Iterable<? extends T> target)
      Matches the supplied value if it was found not to be null.
      Specified by:
      doMatch in class ElementMatcher.Junction.ForNonNullValues<Iterable<? extends T>>
      Parameters:
      target - The instance to be matched.
      Returns:
      true if the given element is matched by this matcher or false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object