Class ExactSequenceMatcher<T>

java.lang.Object
org.hamcrest.BaseMatcher<List<T>>
org.axonframework.test.matchers.ListMatcher<T>
org.axonframework.test.matchers.ExactSequenceMatcher<T>
All Implemented Interfaces:
org.hamcrest.Matcher<List<T>>, org.hamcrest.SelfDescribing

public class ExactSequenceMatcher<T> extends ListMatcher<T>
A matcher that will match if all the given 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.

Since:
1.1
Author:
Allard Buijze
  • Constructor Details

    • ExactSequenceMatcher

      @SafeVarargs public 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.
      Parameters:
      matchers - The matchers that must match against at least one Event in the list.
  • Method Details

    • matchesList

      public boolean matchesList(List<T> events)
      Description copied from class: ListMatcher
      Evaluates the matcher for argument 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.
      Specified by:
      matchesList in class ListMatcher<T>
      Parameters:
      events - the object against which the matcher is evaluated.
      Returns:
      true if item matches, otherwise false.
      See Also:
      • BaseMatcher
    • describeCollectionType

      protected void describeCollectionType(org.hamcrest.Description description)
      Description copied from class: ListMatcher
      Describes the type of collection expected. To be used in the sentence: "list with ... of: ". E.g. "all" or "sequence".
      Specified by:
      describeCollectionType in class ListMatcher<T>
      Parameters:
      description - the description to append the collection type to