Class IsIterableContainingInOrder<E>

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> Matcher<java.lang.Iterable<? extends E>> contains​(E... items)
      Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each logically equal to the corresponding item in the specified items.
      static <E> Matcher<java.lang.Iterable<? extends E>> contains​(java.util.List<Matcher<? super E>> itemMatchers)
      Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each satisfying the corresponding matcher in the specified list of matchers.
      static <E> Matcher<java.lang.Iterable<? extends E>> contains​(Matcher<? super E> itemMatcher)
      Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a single item that satisfies the specified matcher.
      static <E> Matcher<java.lang.Iterable<? extends E>> contains​(Matcher<? super E>... itemMatchers)
      Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each satisfying the corresponding matcher in the specified matchers.
      void describeTo​(Description description)
      Generates a description of the object.
      protected boolean matchesSafely​(java.lang.Iterable<? extends E> iterable, Description mismatchDescription)
      Subclasses should implement this.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IsIterableContainingInOrder

        public IsIterableContainingInOrder​(java.util.List<Matcher<? super E>> matchers)
    • Method Detail

      • matchesSafely

        protected boolean matchesSafely​(java.lang.Iterable<? extends E> iterable,
                                        Description mismatchDescription)
        Description copied from class: TypeSafeDiagnosingMatcher
        Subclasses should implement this. The item will already have been checked for the specific type and will never be null.
        Specified by:
        matchesSafely in class TypeSafeDiagnosingMatcher<java.lang.Iterable<? extends E>>
      • describeTo

        public void describeTo​(Description description)
        Description copied from interface: SelfDescribing
        Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.
        Parameters:
        description - The description to be built or appended to.
      • contains

        public static <E> Matcher<java.lang.Iterable<? extends E>> contains​(E... items)
        Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each logically equal to the corresponding item in the specified items. For a positive match, the examined iterable must be of the same length as the number of specified items.

        For example:

        assertThat(Arrays.asList("foo", "bar"), contains("foo", "bar"))
        Parameters:
        items - the items that must equal the items provided by an examined Iterable
      • contains

        public static <E> Matcher<java.lang.Iterable<? extends E>> contains​(Matcher<? super E> itemMatcher)
        Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a single item that satisfies the specified matcher. For a positive match, the examined iterable must only yield one item.

        For example:

        assertThat(Arrays.asList("foo"), contains(equalTo("foo")))
        Parameters:
        itemMatcher - the matcher that must be satisfied by the single item provided by an examined Iterable
      • contains

        public static <E> Matcher<java.lang.Iterable<? extends E>> contains​(Matcher<? super E>... itemMatchers)
        Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each satisfying the corresponding matcher in the specified matchers. For a positive match, the examined iterable must be of the same length as the number of specified matchers.

        For example:

        assertThat(Arrays.asList("foo", "bar"), contains(equalTo("foo"), equalTo("bar")))
        Parameters:
        itemMatchers - the matchers that must be satisfied by the items provided by an examined Iterable
      • contains

        public static <E> Matcher<java.lang.Iterable<? extends E>> contains​(java.util.List<Matcher<? super E>> itemMatchers)
        Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each satisfying the corresponding matcher in the specified list of matchers. For a positive match, the examined iterable must be of the same length as the specified list of matchers.

        For example:

        assertThat(Arrays.asList("foo", "bar"), contains(Arrays.asList(equalTo("foo"), equalTo("bar"))))
        Parameters:
        itemMatchers - a list of matchers, each of which must be satisfied by the corresponding item provided by an examined Iterable