public class SequenceMatcher<T> extends ListMatcher<T>
matchers each match against an item that the previous
matcher matched against. That means the second matcher should match an item that follow the item that the first
matcher matched.
If the number of items is larger than the number of matchers, the excess items are not evaluated. Use Matchers.exactSequenceOf(org.hamcrest.Matcher[]) to match the sequence exactly. If the last item of the list
has been evaluated, and Matchers still remain, they are evaluated against a null value.| Constructor and Description |
|---|
SequenceMatcher(org.hamcrest.Matcher<? super T>... matchers)
Construct a matcher that will return true if all the given
matchers match against an item
positioned after the item that the previous matcher matched against. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
describeCollectionType(org.hamcrest.Description description)
Describes the type of collection expected.
|
boolean |
matchesList(List<T> items)
Evaluates the matcher for argument
item. |
describeTo, failedMatcherMessage, getLastSeparator, getMatchers, matches, matchRemainder, reportFailed@SafeVarargs public SequenceMatcher(org.hamcrest.Matcher<? super T>... matchers)
matchers match against an item
positioned after the item that the previous matcher matched against.matchers - The matchers that must match against at least one item in the list.public boolean matchesList(List<T> items)
ListMatcheritem. 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>items - the object against which the matcher is evaluated.true if item matches, otherwise false.BaseMatcherprotected void describeCollectionType(org.hamcrest.Description description)
ListMatcherdescribeCollectionType in class ListMatcher<T>description - the description to append the collection type toCopyright © 2010–2023. All rights reserved.