|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hamcrest.Matchers
public class Matchers
Constructor Summary | |
---|---|
Matchers()
|
Method Summary | ||
---|---|---|
static
|
allOf(java.lang.Iterable<Matcher<? extends T>> matchers)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
allOf(Matcher<? extends T>... matchers)
Evaluates to true only if ALL of the passed in matchers evaluate to true. |
|
static
|
any(java.lang.Class<T> type)
This matcher always evaluates to true. |
|
static
|
anyOf(java.lang.Iterable<Matcher<? extends T>> matchers)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anyOf(Matcher<? extends T>... matchers)
Evaluates to true if ANY of the passed in matchers evaluate to true. |
|
static
|
anything()
This matcher always evaluates to true. |
|
static
|
anything(java.lang.String description)
This matcher always evaluates to true. |
|
static Matcher<java.lang.Double> |
closeTo(double operand,
double error)
|
|
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 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 Matcher<java.lang.String> |
equalToIgnoringCase(java.lang.String string)
|
|
static Matcher<java.lang.String> |
equalToIgnoringWhiteSpace(java.lang.String string)
|
|
static Matcher<java.util.EventObject> |
eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass,
java.lang.Object source)
Constructs an IsEventFrom Matcher that returns true for any object derived from eventClass announced by source. |
|
static Matcher<java.util.EventObject> |
eventFrom(java.lang.Object source)
Constructs an IsEventFrom Matcher that returns true for any object derived from EventObject announced by source
. |
|
static
|
greaterThan(T value)
|
|
static
|
greaterThanOrEqualTo(T value)
|
|
static
|
hasEntry(K key,
V value)
|
|
static
|
hasEntry(Matcher<K> keyMatcher,
Matcher<V> valueMatcher)
|
|
static
|
hasItem(Matcher<? extends T> elementMatcher)
|
|
static
|
hasItem(T element)
|
|
static
|
hasItemInArray(Matcher<T> elementMatcher)
|
|
static
|
hasItemInArray(T element)
|
|
static
|
hasItems(Matcher<? extends T>... elementMatchers)
|
|
static
|
hasItems(T... elements)
|
|
static
|
hasKey(K key)
|
|
static
|
hasKey(Matcher<K> keyMatcher)
|
|
static
|
hasProperty(java.lang.String propertyName)
|
|
static
|
hasProperty(java.lang.String propertyName,
Matcher value)
|
|
static
|
hasToString(Matcher<java.lang.String> toStringMatcher)
|
|
static
|
hasValue(Matcher<V> valueMatcher)
|
|
static
|
hasValue(V value)
|
|
static Matcher<org.w3c.dom.Node> |
hasXPath(java.lang.String xPath)
|
|
static Matcher<org.w3c.dom.Node> |
hasXPath(java.lang.String xPath,
Matcher<java.lang.String> valueMatcher)
|
|
static Matcher<java.lang.Object> |
instanceOf(java.lang.Class<?> type)
Is the value an instance of a particular type? |
|
static Matcher<java.lang.Object> |
is(java.lang.Class<?> type)
This is a shortcut to the frequently used is(instanceOf(SomeClass.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
|
isIn(java.util.Collection<T> collection)
|
|
static
|
isIn(T[] param1)
|
|
static
|
isOneOf(T... elements)
|
|
static
|
lessThan(T value)
|
|
static
|
lessThanOrEqualTo(T value)
|
|
static
|
not(Matcher<T> matcher)
Inverts the rule. |
|
static
|
not(T value)
This is a shortcut to the frequently used not(equalTo(x)). |
|
static
|
notNullValue()
Matches if value is not null. |
|
static
|
notNullValue(java.lang.Class<T> type)
Matches if value is not null. |
|
static
|
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)
|
|
static
|
typeCompatibleWith(java.lang.Class<T> baseType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Matchers()
Method Detail |
---|
public static <T> Matcher<T> is(Matcher<T> matcher)
public static <T> Matcher<T> is(T value)
public static Matcher<java.lang.Object> is(java.lang.Class<?> type)
public static <T> Matcher<T> not(Matcher<T> matcher)
public static <T> Matcher<T> not(T value)
public static <T> Matcher<T> equalTo(T operand)
Object.equals(java.lang.Object)
invokedMethod?
public static Matcher<java.lang.Object> instanceOf(java.lang.Class<?> type)
public static <T> Matcher<T> allOf(Matcher<? extends T>... matchers)
public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? extends T>> matchers)
public static <T> Matcher<T> anyOf(Matcher<? extends T>... matchers)
public static <T> Matcher<T> anyOf(java.lang.Iterable<Matcher<? extends T>> matchers)
public static <T> Matcher<T> sameInstance(T object)
object
- The predicate evaluates to true only when the argument is
this object.public static <T> Matcher<T> anything()
public static <T> Matcher<T> anything(java.lang.String description)
description
- A meaningful string used when describing itself.public static <T> Matcher<T> any(java.lang.Class<T> type)
public static <T> Matcher<T> nullValue()
public static <T> Matcher<T> notNullValue()
public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
public static <T> Matcher<T> describedAs(java.lang.String description, Matcher<T> matcher, java.lang.Object... values)
public static <T> Matcher<T[]> hasItemInArray(Matcher<T> elementMatcher)
public static <T> Matcher<T[]> hasItemInArray(T element)
public static <T> Matcher<java.lang.Iterable<T>> hasItem(Matcher<? extends T> elementMatcher)
public static <T> Matcher<java.lang.Iterable<T>> hasItem(T element)
public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? extends T>... elementMatchers)
public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... elements)
public static <K,V> Matcher<java.util.Map<K,V>> hasEntry(Matcher<K> keyMatcher, Matcher<V> valueMatcher)
public static <K,V> Matcher<java.util.Map<K,V>> hasEntry(K key, V value)
public static <K,V> Matcher<java.util.Map<K,V>> hasKey(Matcher<K> keyMatcher)
public static <K,V> Matcher<java.util.Map<K,V>> hasKey(K key)
public static <K,V> Matcher<java.util.Map<K,V>> hasValue(Matcher<V> valueMatcher)
public static <K,V> Matcher<java.util.Map<K,V>> hasValue(V value)
public static <T> Matcher<T> isIn(java.util.Collection<T> collection)
public static <T> Matcher<T> isIn(T[] param1)
public static <T> Matcher<T> isOneOf(T... elements)
public static Matcher<java.lang.Double> closeTo(double operand, double error)
public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThan(T value)
public static <T extends java.lang.Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
public static <T extends java.lang.Comparable<T>> Matcher<T> lessThan(T value)
public static <T extends java.lang.Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)
public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String string)
public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String string)
public static Matcher<java.lang.String> containsString(java.lang.String substring)
public static Matcher<java.lang.String> endsWith(java.lang.String substring)
public static Matcher<java.lang.String> startsWith(java.lang.String substring)
public static <T> Matcher<T> hasToString(Matcher<java.lang.String> toStringMatcher)
public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
public static Matcher<java.util.EventObject> eventFrom(java.lang.Class<? extends java.util.EventObject> eventClass, java.lang.Object source)
public static Matcher<java.util.EventObject> eventFrom(java.lang.Object source)
EventObject
announced by source
.
public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
public static <T> Matcher<T> hasProperty(java.lang.String propertyName, Matcher value)
public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, Matcher<java.lang.String> valueMatcher)
public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |