Class ListMatcher

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<List<?>>
org.elasticsearch.test.ListMatcher
All Implemented Interfaces:
org.hamcrest.Matcher<List<?>>, org.hamcrest.SelfDescribing

public class ListMatcher extends org.hamcrest.TypeSafeMatcher<List<?>>
Matcher for Lists that reports all errors at once.
  • Method Details

    • matchesList

      public static ListMatcher matchesList()
      Create a ListMatcher that matches empty lists.
    • matchesList

      public static ListMatcher matchesList(List<?> list)
      Create a ListMatcher that matches a list.
    • item

      public ListMatcher item(Object value)
      Expect a value.

      Passing a Matcher to this method will function as though you passed it directly to item(Matcher).

      Returns:
      a new ListMatcher that expects all items this matcher expected followed by the provided item
    • item

      public ListMatcher item(org.hamcrest.Matcher<?> valueMatcher)
      Expect a Matcher.
      Returns:
      a new ListMatcher that expects all items this matcher expected followed by the provided item
    • matchesSafely

      protected boolean matchesSafely(List<?> item)
      Specified by:
      matchesSafely in class org.hamcrest.TypeSafeMatcher<List<?>>
    • describeMismatchSafely

      protected void describeMismatchSafely(List<?> item, org.hamcrest.Description description)
      Overrides:
      describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<List<?>>