public class ExtraMatchers
extends java.lang.Object
Constructor and Description |
---|
ExtraMatchers() |
Modifier and Type | Method and Description |
---|---|
static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> |
ordered(java.util.List<T> itemMatchers)
Creates a matcher for
Iterable s 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 . |
static org.hamcrest.Matcher<java.lang.String> |
regex(java.lang.String pattern)
Deprecated.
use
Matchers.matchesRegex(String) instead |
public static <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> ordered(java.util.List<T> itemMatchers)
Iterable
s 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")))
T
- the typeitemMatchers
- the matchers to apply to items provided by the examined Iterable
@Deprecated public static org.hamcrest.Matcher<java.lang.String> regex(java.lang.String pattern)
Matchers.matchesRegex(String)
insteadString
that matches against a regex pattern.
Returns success based on java.util.regex.Pattern.matcher(input).matches();
pattern
- the Pattern
syntax pattern to match against.Copyright © 1995–2024 Mort Bay Consulting. All rights reserved.