Package org.eclipse.jetty.toolchain.test
Class ExtraMatchers
- java.lang.Object
-
- org.eclipse.jetty.toolchain.test.ExtraMatchers
-
public class ExtraMatchers extends java.lang.Object
Extra Matchers for the Junit Hamcrest users out there.
-
-
Constructor Summary
Constructors Constructor Description ExtraMatchers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>>
ordered(java.util.List<T> itemMatchers)
Creates a matcher forIterable
s that matches when consecutive passes over the examinedIterable
yield at least one item that is matched by the corresponding matcher from the specifieditemMatchers
.
-
-
-
Method Detail
-
ordered
public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> ordered(java.util.List<T> itemMatchers)
Creates a matcher forIterable
s that matches when consecutive passes over the examinedIterable
yield at least one item that is matched by the corresponding matcher from the specifieditemMatchers
. Whilst matching, each traversal of the examinedIterable
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 examinedIterable
- Returns:
- the matcher
-
-