Top Inners Fields Constructors Methods
org.hamcrest.collection

public Class IsIterableContainingInRelativeOrder<E>

extends TypeSafeDiagnosingMatcher<Iterable<? extends E>>
Class Inheritance
Imports
org.hamcrest.Description, .Matcher, .TypeSafeDiagnosingMatcher, java.util.ArrayList, .List

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final List<Matcher<? super E>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <E> Matcher<Iterable<? extends E>>
containsInRelativeOrder(E...
the items that must be contained within items provided by an examined Iterable in the same relative order
items
)

Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, that contains items logically equal to the corresponding item in the specified items, in the same relative order For example:

assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
public static <E> Matcher<Iterable<? extends E>>
containsInRelativeOrder(Matcher<? super E>...
the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order
itemMatchers
)

Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, that each satisfying the corresponding matcher in the specified matchers, in the same relative order.

public static <E> Matcher<Iterable<? extends E>>
containsInRelativeOrder(List<Matcher<? super E>>
a list of matchers, each of which must be satisfied by the items provided by an examined Iterable in the same relative order
itemMatchers
)

Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, that contains items satisfying the corresponding matcher in the specified list of matchers, in the same relative order.

public void
describeTo(Description
The description to be built or appended to.
description
)

Implements org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object.
protected boolean
matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription)

Implements abstract org.hamcrest.TypeSafeDiagnosingMatcher.matchesSafely.

Subclasses should implement this.
Inherited from org.hamcrest.TypeSafeDiagnosingMatcher:
describeMismatchmatches

Field Detail

matchersback to summary
private final List<Matcher<? super E>> matchers

Constructor Detail

IsIterableContainingInRelativeOrderback to summary
public IsIterableContainingInRelativeOrder(List<Matcher<? super E>> matchers)

Method Detail

containsInRelativeOrderback to summary
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(E... items)

Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, that contains items logically equal to the corresponding item in the specified items, in the same relative order For example:

assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder("b", "d"))
Parameters
items:E[]

the items that must be contained within items provided by an examined Iterable in the same relative order

Annotations
@SafeVarargs
containsInRelativeOrderback to summary
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers)

Creates a matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, that each satisfying the corresponding matcher in the specified matchers, in the same relative order. For example:

assertThat(Arrays.asList("a", "b", "c", "d", "e"), containsInRelativeOrder(equalTo("b"), equalTo("d")))
Parameters
itemMatchers:Matcher<? super E>[]

the matchers that must be satisfied by the items provided by an examined Iterable in the same relative order

Annotations
@SafeVarargs
containsInRelativeOrderback to summary
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(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, that contains items satisfying the corresponding matcher in the specified list of matchers, in the same relative order. For example:

assertThat(Arrays.asList("a", "b", "c", "d", "e"), contains(Arrays.asList(equalTo("b"), equalTo("d"))))
Parameters
itemMatchers:List<Matcher<? super E>>

a list of matchers, each of which must be satisfied by the items provided by an examined Iterable in the same relative order

describeToback to summary
public void describeTo(Description description)

Implements org.hamcrest.SelfDescribing.describeTo.

Doc from org.hamcrest.SelfDescribing.describeTo.

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:Description

The description to be built or appended to.

matchesSafelyback to summary
protected boolean matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription)

Implements abstract org.hamcrest.TypeSafeDiagnosingMatcher.matchesSafely.

Doc from org.hamcrest.TypeSafeDiagnosingMatcher.matchesSafely.

Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override
org.hamcrest.collection back to summary

private Class IsIterableContainingInRelativeOrder.MatchSeriesInRelativeOrder<F>

extends Object
Class Inheritance
  • java.lang.Object
  • org.hamcrest.collection.IsIterableContainingInRelativeOrder.MatchSeriesInRelativeOrder

Field Summary

Modifier and TypeField and Description
private F
public final List<Matcher<? super F>>
private final Description
private int

Constructor Summary

AccessConstructor and Description
public
MatchSeriesInRelativeOrder(List<Matcher<? super F>> matchers, Description mismatchDescription)

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
processItems(Iterable<? extends F> iterable)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastMatchedItemback to summary
private F lastMatchedItem
matchersback to summary
public final List<Matcher<? super F>> matchers
mismatchDescriptionback to summary
private final Description mismatchDescription
nextMatchIxback to summary
private int nextMatchIx

Constructor Detail

MatchSeriesInRelativeOrderback to summary
public MatchSeriesInRelativeOrder(List<Matcher<? super F>> matchers, Description mismatchDescription)

Method Detail

isFinishedback to summary
public boolean isFinished()
processItemsback to summary
public void processItems(Iterable<? extends F> iterable)