|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hamcrest.CoreMatchers
public class CoreMatchers
| Constructor Summary | |
|---|---|
CoreMatchers()
|
|
| Method Summary | ||
|---|---|---|
static
|
allOf(java.lang.Iterable<Matcher<? super T>> matchers)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T>... matchers)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T> first,
Matcher<? super T> second)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth,
Matcher<? super T> sixth)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
any(java.lang.Class<T> type)
Is the value an instance of a particular type? |
|
static
|
anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<? super T>... matchers)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
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)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static Matcher<java.lang.Object> |
anything()
This matcher always evaluates to true. |
|
static Matcher<java.lang.Object> |
anything(java.lang.String description)
This matcher always evaluates to true. |
|
static
|
both(Matcher<? super LHS> matcher)
This is useful for fluently combining matchers that must both pass. |
|
static Matcher<java.lang.String> |
containsString(java.lang.String substring)
|
|
static
|
describedAs(java.lang.String description,
Matcher<T> matcher,
java.lang.Object... values)
Wraps an existing matcher and overrides the description when it fails. |
|
static
|
either(Matcher<? super LHS> matcher)
This is useful for fluently combining matchers where either may pass, for example: assertThat(string, both(containsString("a")).and(containsString("b"))); |
|
static Matcher<java.lang.String> |
endsWith(java.lang.String substring)
|
|
static
|
equalTo(T operand)
Is the value equal to another value, as tested by the Object.equals(java.lang.Object) invokedMethod? |
|
static
|
everyItem(Matcher<U> itemMatcher)
|
|
static
|
hasItem(Matcher<? super T> elementMatcher)
|
|
static
|
hasItem(T element)
|
|
static
|
hasItems(Matcher<? super T>... elementMatchers)
|
|
static
|
hasItems(T... elements)
|
|
static
|
instanceOf(java.lang.Class<?> type)
Is the value an instance of a particular type? |
|
static
|
is(java.lang.Class<T> type)
Deprecated. use isA(Class |
|
static
|
is(Matcher<T> matcher)
Decorates another Matcher, retaining the behavior but allowing tests to be slightly more expressive. |
|
static
|
is(T value)
This is a shortcut to the frequently used is(equalTo(x)). |
|
static
|
isA(java.lang.Class<T> type)
|
|
static
|
not(Matcher<T> matcher)
Inverts the rule. |
|
static
|
not(T value)
This is a shortcut to the frequently used not(equalTo(x)). |
|
static Matcher<java.lang.Object> |
notNullValue()
Matches if value is not null. |
|
static
|
notNullValue(java.lang.Class<T> type)
Matches if value is not null. |
|
static Matcher<java.lang.Object> |
nullValue()
Matches if value is null. |
|
static
|
nullValue(java.lang.Class<T> type)
Matches if value is null. |
|
static
|
sameInstance(T object)
Creates a new instance of IsSame |
|
static Matcher<java.lang.String> |
startsWith(java.lang.String substring)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CoreMatchers()
| Method Detail |
|---|
public static <T> Matcher<T> allOf(Matcher<? super T>... matchers)
public static <T> Matcher<T> allOf(Matcher<? super T> first,
Matcher<? super T> second)
public static <T> Matcher<T> allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
public static <T> Matcher<T> allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
public static <T> Matcher<T> allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth)
public static <T> Matcher<T> allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth,
Matcher<? super T> sixth)
public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
public static <T> AnyOf<T> anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
public static <T> AnyOf<T> anyOf(Matcher<T> first,
Matcher<? super T> second)
public static <T> AnyOf<T> anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third)
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers)
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)
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)
public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
public static <LHS> CombinableMatcher<LHS> both(Matcher<? super LHS> matcher)
assertThat(string, both(containsString("a")).and(containsString("b")));
public static <LHS> CombinableMatcher<LHS> either(Matcher<? super LHS> matcher)
assertThat(string, both(containsString("a")).and(containsString("b")));
public static <T> Matcher<T> describedAs(java.lang.String description,
Matcher<T> matcher,
java.lang.Object... values)
public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
itemMatcher - A matcher to apply to every element in a collection.
public static <T> Matcher<T> is(Matcher<T> matcher)
public static <T> Matcher<T> is(T value)
public static <T> Matcher<T> is(java.lang.Class<T> type)
public static <T> Matcher<T> isA(java.lang.Class<T> type)
public static Matcher<java.lang.Object> anything()
public static Matcher<java.lang.Object> anything(java.lang.String description)
description - A meaningful string used when describing itself.public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T element)
public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> elementMatcher)
public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... elementMatchers)
public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... elements)
public static <T> Matcher<T> equalTo(T operand)
Object.equals(java.lang.Object) invokedMethod?
public static <T> Matcher<T> any(java.lang.Class<T> type)
with(any(Thing.class))
public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
assertThat(anObject, instanceOf(Thing.class));
public static <T> Matcher<T> not(Matcher<T> matcher)
public static <T> Matcher<T> not(T value)
public static Matcher<java.lang.Object> nullValue()
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
public static Matcher<java.lang.Object> notNullValue()
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
public static <T> Matcher<T> sameInstance(T object)
object - The predicate evaluates to true only when the argument is
this object.public static Matcher<java.lang.String> containsString(java.lang.String substring)
public static Matcher<java.lang.String> startsWith(java.lang.String substring)
public static Matcher<java.lang.String> endsWith(java.lang.String substring)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||