Package org.axonframework.test.matchers
Class ListMatcher<T>
java.lang.Object
org.hamcrest.BaseMatcher<List<T>>
org.axonframework.test.matchers.ListMatcher<T>
- All Implemented Interfaces:
org.hamcrest.Matcher<List<T>>,org.hamcrest.SelfDescribing
- Direct Known Subclasses:
ExactSequenceMatcher,ListWithAllOfMatcher,ListWithAnyOfMatcher,SequenceMatcher
Abstract implementation for matchers that use event-specific matchers to match against a list of items.
- Since:
- 1.1
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedListMatcher(org.hamcrest.Matcher<? super T>... matchers) Creates an abstract matcher to match a number of Matchers against Events contained inside a Collection. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddescribeCollectionType(org.hamcrest.Description description) Describes the type of collection expected.voiddescribeTo(org.hamcrest.Description description) protected StringThe message to append behind a failing matcher.protected StringThe separator to use between the two last events.Returns a read-only list of Matchers, in the order they were provided in the constructor.booleanprotected abstract booleanmatchesList(List<T> item) Evaluates the matcher for argumentitem.protected booleanmatchRemainder(Iterator<org.hamcrest.Matcher<? super T>> matcherIterator) Matches all the remaining Matchers in the givenmatcherIteratoragainstnull.protected voidreportFailed(org.hamcrest.Matcher<? super T> matcher) Report the givenmatcheras a failing matcher.Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toString
-
Constructor Details
-
ListMatcher
Creates an abstract matcher to match a number of Matchers against Events contained inside a Collection.- Parameters:
matchers- The matchers to match the individual Events in the Collection
-
-
Method Details
-
matches
-
matchesList
Evaluates the matcher for argumentitem. 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.- Parameters:
item- the object against which the matcher is evaluated.- Returns:
trueifitemmatches, otherwisefalse.- See Also:
-
matchRemainder
Matches all the remaining Matchers in the givenmatcherIteratoragainstnull.- Parameters:
matcherIterator- The iterator potentially containing more matchers- Returns:
- true if no matchers remain or all matchers succeeded
-
reportFailed
Report the givenmatcheras a failing matcher. This will be used in the error reporting.- Parameters:
matcher- The failing matcher.
-
getMatchers
Returns a read-only list of Matchers, in the order they were provided in the constructor.- Returns:
- a read-only list of Matchers, in the order they were provided in the constructor
-
describeCollectionType
protected abstract void describeCollectionType(org.hamcrest.Description description) Describes the type of collection expected. To be used in the sentence: "list with ... of:". E.g. "all" or "sequence". - Parameters:
description- the description to append the collection type to
-
describeTo
public void describeTo(org.hamcrest.Description description) -
failedMatcherMessage
The message to append behind a failing matcher. Defaults to FAILED!.- Returns:
- The message to append behind a failing matcher
-
getLastSeparator
The separator to use between the two last events. Defaults to "and".- Returns:
- The separator to use between the two last events. Defaults to "and".
-