Top Inners Fields Constructors Methods
org.hamcrest.collection

public Class IsIterableContainingInOrder<E>

extends TypeSafeDiagnosingMatcher<Iterable<? extends E>>
Class Inheritance
Imports
org.hamcrest.Description, .Factory, .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>>
contains(E...
the items that must equal the items provided by an examined Iterable
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.

public static <E> Matcher<Iterable<? extends E>>
contains(final Matcher<? super E>
the matcher that must be satisfied by the single item provided by an examined Iterable
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.

public static <E> Matcher<Iterable<? extends E>>
contains(Matcher<? super E>...
the matchers that must be satisfied by the items provided by an examined Iterable
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.

public static <E> Matcher<Iterable<? extends E>>
contains(List<Matcher<? super E>>
a list of matchers, each of which must be satisfied by the corresponding item provided by an examined Iterable
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.

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

IsIterableContainingInOrderback to summary
public IsIterableContainingInOrder(List<Matcher<? super E>> matchers)

Method Detail

containsback to summary
public static <E> Matcher<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:E[]

the items that must equal the items provided by an examined Iterable

Annotations
@Factory
containsback to summary
public static <E> Matcher<Iterable<? extends E>> contains(final 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:Matcher<? super E>

the matcher that must be satisfied by the single item provided by an examined Iterable

Annotations
@SuppressWarnings:unchecked
@Factory
containsback to summary
public static <E> Matcher<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:Matcher<? super E>[]

the matchers that must be satisfied by the items provided by an examined Iterable

Annotations
@Factory
containsback to summary
public static <E> Matcher<Iterable<? extends E>> contains(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:List<Matcher<? super E>>

a list of matchers, each of which must be satisfied by the corresponding item provided by an examined Iterable

Annotations
@Factory
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.

Annotations
@Override
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 IsIterableContainingInOrder.MatchSeries<F>

extends Object
Class Inheritance
  • java.lang.Object
  • org.hamcrest.collection.IsIterableContainingInOrder.MatchSeries

Field Summary

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

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
private void
describeMismatch(Matcher<? super F> matcher, F item)

public boolean
private boolean
isMatched(F item)

private boolean
isNotSurplus(F item)

public boolean
matches(F item)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

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

Constructor Detail

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

Method Detail

describeMismatchback to summary
private void describeMismatch(Matcher<? super F> matcher, F item)
isFinishedback to summary
public boolean isFinished()
isMatchedback to summary
private boolean isMatched(F item)
isNotSurplusback to summary
private boolean isNotSurplus(F item)
matchesback to summary
public boolean matches(F item)