Class ExtraMatchers

java.lang.Object
org.eclipse.jetty.toolchain.test.ExtraMatchers

public class ExtraMatchers extends Object
Extra Matchers for the Junit Hamcrest users out there.
  • Constructor Details

    • ExtraMatchers

      public ExtraMatchers()
  • Method Details

    • ordered

      public static <T> org.hamcrest.Matcher<Iterable<? super T>> ordered(List<T> itemMatchers)
      Creates a matcher for Iterables that matches when consecutive passes over the examined Iterable yield at least one item that is matched by the corresponding matcher from the specified itemMatchers. Whilst matching, each traversal of the examined Iterable will stop as soon as a matching item is found.

      For example:

       assertThat(Arrays.asList("foo","bar","baz"),hasItems(endsWith("z"),endsWith("o")))
       
      Type Parameters:
      T - the type
      Parameters:
      itemMatchers - the matchers to apply to items provided by the examined Iterable
      Returns:
      the matcher