|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hamcrest.BaseMatcher<T>
org.hamcrest.core.AnyOf<T>
public class AnyOf<T>
Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so
subsequent matchers are not called if an earlier matcher returns true
.
Constructor Summary | |
---|---|
AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
|
Method Summary | ||
---|---|---|
static
|
anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth,
Matcher<? super T> sixth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers. |
|
void |
describeTo(Description description)
Generates a description of the object. |
|
void |
describeTo(Description description,
java.lang.String operator)
|
|
boolean |
matches(java.lang.Object o)
Evaluates the matcher for argument item. |
|
protected boolean |
matches(java.lang.Object o,
boolean shortcut)
|
Methods inherited from class org.hamcrest.BaseMatcher |
---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AnyOf(java.lang.Iterable<Matcher<? super T>> matchers)
Method Detail |
---|
public boolean matches(java.lang.Object o)
Matcher
This method matches against Object, instead of the generic type T. This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type.
matches
in interface Matcher<T>
o
- the object against which the matcher is evaluated.
true
if item matches, otherwise false
.BaseMatcher
public void describeTo(Description description)
SelfDescribing
describeTo
in interface SelfDescribing
description
- The description to be built or appended to.public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<T> first, Matcher<? super T> second)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<T> first, Matcher<? super T> second, Matcher<? super T> third)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
public static <T> AnyOf<T> anyOf(Matcher<T> first, Matcher<? super T> second, Matcher<? super T> third, Matcher<? super T> fourth, Matcher<? super T> fifth, Matcher<? super T> sixth)
For example:
assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))
protected boolean matches(java.lang.Object o, boolean shortcut)
public void describeTo(Description description, java.lang.String operator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |