public class ExactSequenceMatcher<T> extends ListMatcher<T>
matchers
against the event in a list at their respective
index. That means the first matcher must match against the first event, the second matcher against the second event,
and so forth.
If the number of Events is larger than the number of matchers, the excess events are not evaluated. Use Matchers.exactSequenceOf(org.hamcrest.Matcher[])
to match the sequence exactly. If there are more matchers
than Events, the remainder of matchers is evaluated against a null
value.Constructor and Description |
---|
ExactSequenceMatcher(org.hamcrest.Matcher<? super T>... matchers)
Construct a matcher that will return true if all the given
matchers match against the event with
the same index in a given List if Events. |
Modifier and Type | Method and Description |
---|---|
protected void |
describeCollectionType(org.hamcrest.Description description)
Describes the type of collection expected.
|
boolean |
matchesList(List<T> events)
Evaluates the matcher for argument
item . |
describeTo, failedMatcherMessage, getLastSeparator, getMatchers, matches, matchRemainder, reportFailed
public ExactSequenceMatcher(org.hamcrest.Matcher<? super T>... matchers)
matchers
match against the event with
the same index in a given List if Events.matchers
- The matchers that must match against at least one Event in the list.public boolean matchesList(List<T> events)
ListMatcher
item
. The item has been verified to be a list, but the exact
type of contents of a list cannot be verified, due to Erasure of Generic Types.matchesList
in class ListMatcher<T>
events
- the object against which the matcher is evaluated.true
if item
matches, otherwise false
.BaseMatcher
protected void describeCollectionType(org.hamcrest.Description description)
ListMatcher
describeCollectionType
in class ListMatcher<T>
description
- the description to append the collection type toCopyright © 2010–2017. All rights reserved.