public abstract class ListMatcher<T> extends org.hamcrest.BaseMatcher<List<T>>
Modifier | Constructor and Description |
---|---|
protected |
ListMatcher(org.hamcrest.Matcher<? super T>... matchers)
Creates an abstract matcher to match a number of Matchers against Events contained inside a Collection.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
describeCollectionType(org.hamcrest.Description description)
Describes the type of collection expected.
|
void |
describeTo(org.hamcrest.Description description) |
protected String |
failedMatcherMessage()
The message to append behind a failing matcher.
|
protected String |
getLastSeparator()
The separator to use between the two last events.
|
protected List<org.hamcrest.Matcher<? super T>> |
getMatchers()
Returns a read-only list of Matchers, in the order they were provided in the constructor.
|
boolean |
matches(Object item) |
protected abstract boolean |
matchesList(List<T> item)
Evaluates the matcher for argument
item . |
protected boolean |
matchRemainder(Iterator<org.hamcrest.Matcher<? super T>> matcherIterator)
Matches all the remaining Matchers in the given
matcherIterator against null . |
protected void |
reportFailed(org.hamcrest.Matcher<? super T> matcher)
Report the given
matcher as a failing matcher. |
@SafeVarargs protected ListMatcher(org.hamcrest.Matcher<? super T>... matchers)
matchers
- The matchers to match the individual Events in the Collectionpublic boolean matches(Object item)
protected abstract boolean matchesList(List<T> item)
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.item
- the object against which the matcher is evaluated.true
if item
matches, otherwise false
.BaseMatcher
protected boolean matchRemainder(Iterator<org.hamcrest.Matcher<? super T>> matcherIterator)
matcherIterator
against null
.matcherIterator
- The iterator potentially containing more matchersprotected void reportFailed(org.hamcrest.Matcher<? super T> matcher)
matcher
as a failing matcher. This will be used in the error reporting.matcher
- The failing matcher.protected List<org.hamcrest.Matcher<? super T>> getMatchers()
protected abstract void describeCollectionType(org.hamcrest.Description description)
description
- the description to append the collection type topublic void describeTo(org.hamcrest.Description description)
protected String failedMatcherMessage()
protected String getLastSeparator()
Copyright © 2010–2017. All rights reserved.