org.hamcrest
Class Matchers

java.lang.Object
  extended by org.hamcrest.Matchers

public class Matchers
extends java.lang.Object


Constructor Summary
Matchers()
           
 
Method Summary
static
<T> Matcher<T>
allOf(java.lang.Iterable<Matcher<? super T>> matchers)
          Evaluates to true only if ALL of the passed in matchers evaluate to true.
static
<T> Matcher<T>
allOf(Matcher<? super T>... param1)
           
static
<T> Matcher<T>
allOf(Matcher<T> first, Matcher<? super T> second)
          Evaluates to true only if ALL of the passed in matchers evaluate to true.
static
<T> Matcher<T>
allOf(Matcher<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
<T> Matcher<T>
allOf(Matcher<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
<T> Matcher<T>
allOf(Matcher<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
<T> Matcher<T>
allOf(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 only if ALL of the passed in matchers evaluate to true.
static
<T> Matcher<T>
any(java.lang.Class<T> type)
          Is the value an instance of a particular type? Use this version to make generics conform, for example in the JMock clause with(any(Thing.class))
static
<T> AnyOf<T>
anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
          Evaluates to true if ANY of the passed in matchers evaluate to true.
static
<T> AnyOf<T>
anyOf(Matcher<? super T>... param1)
           
static
<T> AnyOf<T>
anyOf(Matcher<T> first, Matcher<? super T> second)
          Evaluates to true if ANY of the passed in matchers evaluate to true.
static
<T> AnyOf<T>
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
<T> AnyOf<T>
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
<T> AnyOf<T>
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
<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)
          Evaluates to true if ANY of the passed in matchers evaluate to true.
static
<T> Matcher<T>
anything()
          This matcher always evaluates to true.
static
<T> Matcher<T>
anything(java.lang.String description)
          This matcher always evaluates to true.
static
<T> IsArray<T>
array(Matcher<? super T>... param1)
           
static
<E> Matcher<E[]>
arrayContaining(E... param1)
           
static
<E> Matcher<E[]>
arrayContaining(java.util.List<Matcher<? super E>> matchers)
           
static
<E> Matcher<E[]>
arrayContaining(Matcher<? super E>... param1)
           
static
<E> Matcher<E[]>
arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)
           
static
<E> Matcher<E[]>
arrayContainingInAnyOrder(E... param1)
           
static
<E> Matcher<E[]>
arrayContainingInAnyOrder(Matcher<? super E>... param1)
           
static
<E> Matcher<E[]>
arrayWithSize(int size)
          This is a shortcut to the frequently used arrayWithSize(equalTo(x)).
static
<E> Matcher<E[]>
arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
          Does array size satisfy a given matcher?
static
<LHS> CombinableMatcher<LHS>
both(Matcher<? super LHS> matcher)
          This is useful for fluently combining matchers that must both pass.
static Matcher<java.lang.Double> closeTo(double operand, double error)
           
static
<T extends java.lang.Comparable<T>>
Matcher<? super T>
comparesEqualTo(T value)
          Is value = expected?
static
<E> Matcher<java.lang.Iterable<E>>
contains(E... param1)
           
static
<E> Matcher<java.lang.Iterable<E>>
contains(java.util.List<Matcher<? super E>> contents)
           
static
<E> Matcher<java.lang.Iterable<E>>
contains(Matcher<? super E>... item)
           
static
<E> Matcher<java.lang.Iterable<E>>
contains(Matcher<E> item)
           
static
<T> Matcher<java.lang.Iterable<T>>
containsInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)
           
static
<T> Matcher<java.lang.Iterable<T>>
containsInAnyOrder(Matcher<? super T>... item)
           
static
<E> Matcher<java.lang.Iterable<E>>
containsInAnyOrder(Matcher<E> item)
           
static
<T> Matcher<java.lang.Iterable<T>>
containsInAnyOrder(T... param1)
           
static Matcher<java.lang.String> containsString(java.lang.String substring)
           
static
<T> Matcher<T>
describedAs(java.lang.String param1, Matcher<T> param2, java.lang.Object... param3)
           
static
<LHS> CombinableMatcher<LHS>
either(Matcher<? super LHS> matcher)
          This is useful for fluently combining matchers where either may pass, for example:
static
<E> Matcher<java.util.Collection<E>>
empty()
          Matches an empty collection.
static
<E> Matcher<E[]>
emptyArray()
          Matches an empty array.
static
<E> Matcher<java.lang.Iterable<E>>
emptyIterable()
          Matches an empty iterable.
static Matcher<java.lang.String> endsWith(java.lang.String substring)
           
static
<T> Matcher<? super T>
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
<U> Matcher<java.lang.Iterable<U>>
everyItem(Matcher<U> itemMatcher)
           
static
<T extends java.lang.Comparable<T>>
Matcher<? super T>
greaterThan(T value)
          Is value > expected?
static
<T extends java.lang.Comparable<T>>
Matcher<? super T>
greaterThanOrEqualTo(T value)
          Is value >= expected?
static
<K,V> Matcher<java.util.Map<? extends K,? extends V>>
hasEntry(K key, V value)
           
static
<K,V> Matcher<java.util.Map<? extends K,? extends V>>
hasEntry(Matcher<? super K> keyMatcher, Matcher<? super V> valueMatcher)
           
static
<T> Matcher<java.lang.Iterable<? super T>>
hasItem(Matcher<? super T> elementMatcher)
           
static
<T> Matcher<java.lang.Iterable<? super T>>
hasItem(T element)
           
static
<T> Matcher<T[]>
hasItemInArray(Matcher<? super T> elementMatcher)
          Evaluates to true if any item in an array satisfies the given matcher.
static
<T> Matcher<T[]>
hasItemInArray(T element)
          This is a shortcut to the frequently used hasItemInArray(equalTo(x)).
static
<T> Matcher<java.lang.Iterable<T>>
hasItems(Matcher<? super T>... param1)
           
static
<T> Matcher<java.lang.Iterable<T>>
hasItems(T... param1)
           
static
<K> Matcher<java.util.Map<? super K,?>>
hasKey(K key)
           
static
<K> Matcher<java.util.Map<? super K,?>>
hasKey(Matcher<? super K> keyMatcher)
           
static
<T> Matcher<T>
hasProperty(java.lang.String propertyName)
           
static
<T> Matcher<T>
hasProperty(java.lang.String propertyName, Matcher<?> value)
           
static
<E> Matcher<? super java.util.Collection<? extends E>>
hasSize(int size)
          This is a shortcut to the frequently used hasSize(equalTo(x)).
static
<E> Matcher<? super java.util.Collection<? extends E>>
hasSize(Matcher<? super java.lang.Integer> size)
          Does collection size satisfy a given matcher?
static
<T> Matcher<T>
hasToString(Matcher<? super java.lang.String> toStringMatcher)
          Evaluates whether item.toString() satisfies a given matcher.
static
<T> Matcher<T>
hasToString(java.lang.String expectedToString)
          This is a shortcut to the frequently used has_string(equalTo(x)).
static
<V> Matcher<? super java.util.Map<?,V>>
hasValue(Matcher<? super V> valueMatcher)
           
static
<V> Matcher<? super java.util.Map<?,V>>
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<? super java.lang.String> valueMatcher)
           
static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext)
           
static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext, Matcher<? super java.lang.String> valueMatcher)
           
static
<T> Matcher<T>
instanceOf(java.lang.Class<?> type)
          Is the value an instance of a particular type? This version assumes no relationship between the required type and the signature of the method that sets it up, for example in assertThat(anObject, instanceOf(Thing.class));
static
<T> Matcher<? super T>
is(java.lang.Class<T> type)
          This is a shortcut to the frequently used is(instanceOf(SomeClass.class)).
static
<T> Matcher<T>
is(Matcher<T> matcher)
          Decorates another Matcher, retaining the behavior but allowing tests to be slightly more expressive.
static
<T> Matcher<? super T>
is(T value)
          This is a shortcut to the frequently used is(equalTo(x)).
static
<T> Matcher<T>
isIn(java.util.Collection<T> collection)
           
static
<T> Matcher<T>
isIn(T[] param1)
           
static
<T> Matcher<T>
isOneOf(T... param1)
           
static
<E> Matcher<java.lang.Iterable<E>>
iterableWithSize(int size)
           
static
<E> Matcher<java.lang.Iterable<E>>
iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
           
static
<T extends java.lang.Comparable<T>>
Matcher<? super T>
lessThan(T value)
          Is value < expected?
static
<T extends java.lang.Comparable<T>>
Matcher<? super T>
lessThanOrEqualTo(T value)
          Is value <= expected?
static
<T> Matcher<T>
not(Matcher<T> matcher)
          Inverts the rule.
static
<T> Matcher<? super T>
not(T value)
          This is a shortcut to the frequently used not(equalTo(x)).
static
<T> Matcher<T>
notNullValue()
          Matches if value is not null.
static
<T> Matcher<T>
notNullValue(java.lang.Class<T> type)
          Matches if value is not null.
static
<T> Matcher<T>
nullValue()
          Matches if value is null.
static
<T> Matcher<T>
nullValue(java.lang.Class<T> type)
          Matches if value is null.
static
<T> Matcher<T>
sameInstance(T object)
          Creates a new instance of IsSame
static
<T> Matcher<T>
samePropertyValuesAs(T expectedBean)
           
static Matcher<java.lang.String> startsWith(java.lang.String substring)
           
static
<T> Matcher<java.lang.Class<?>>
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

Matchers

public Matchers()
Method Detail

allOf

public static <T> Matcher<T> allOf(java.lang.Iterable<Matcher<? super T>> matchers)
Evaluates to true only if ALL of the passed in matchers evaluate to true.


allOf

public static <T> Matcher<T> allOf(Matcher<? super T>... param1)

allOf

public static <T> Matcher<T> allOf(Matcher<T> first,
                                   Matcher<? super T> second)
Evaluates to true only if ALL of the passed in matchers evaluate to true.


allOf

public static <T> Matcher<T> allOf(Matcher<T> first,
                                   Matcher<? super T> second,
                                   Matcher<? super T> third)
Evaluates to true only if ALL of the passed in matchers evaluate to true.


allOf

public static <T> Matcher<T> allOf(Matcher<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.


allOf

public static <T> Matcher<T> allOf(Matcher<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.


allOf

public static <T> Matcher<T> allOf(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 only if ALL of the passed in matchers evaluate to true.


anyOf

public static <T> AnyOf<T> anyOf(java.lang.Iterable<Matcher<? super T>> matchers)
Evaluates to true if ANY of the passed in matchers evaluate to true.


anyOf

public static <T> AnyOf<T> anyOf(Matcher<? super T>... param1)

anyOf

public static <T> AnyOf<T> anyOf(Matcher<T> first,
                                 Matcher<? super T> second)
Evaluates to true if ANY of the passed in matchers evaluate to true.


anyOf

public static <T> AnyOf<T> 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.


anyOf

public static <T> AnyOf<T> 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.


anyOf

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)
Evaluates to true if ANY of the passed in matchers evaluate to true.


anyOf

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)
Evaluates to true if ANY of the passed in matchers evaluate to true.


both

public static <LHS> CombinableMatcher<LHS> both(Matcher<? super LHS> matcher)
This is useful for fluently combining matchers that must both pass. For example:
   assertThat(string, both(containsString("a")).and(containsString("b")));
 


either

public static <LHS> CombinableMatcher<LHS> 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")));
 


describedAs

public static <T> Matcher<T> describedAs(java.lang.String param1,
                                         Matcher<T> param2,
                                         java.lang.Object... param3)

everyItem

public static <U> Matcher<java.lang.Iterable<U>> everyItem(Matcher<U> itemMatcher)
Parameters:
itemMatcher - A matcher to apply to every element in a collection.
Returns:
Evaluates to TRUE for a collection in which every item matches itemMatcher

is

public static <T> Matcher<T> is(Matcher<T> matcher)
Decorates another Matcher, retaining the behavior but allowing tests to be slightly more expressive. For example: assertThat(cheese, equalTo(smelly)) vs. assertThat(cheese, is(equalTo(smelly)))


is

public static <T> Matcher<? super T> is(T value)
This is a shortcut to the frequently used is(equalTo(x)). For example: assertThat(cheese, is(equalTo(smelly))) vs. assertThat(cheese, is(smelly))


is

public static <T> Matcher<? super T> is(java.lang.Class<T> type)
This is a shortcut to the frequently used is(instanceOf(SomeClass.class)). For example: assertThat(cheese, is(instanceOf(Cheddar.class))) vs. assertThat(cheese, is(Cheddar.class))


anything

public static <T> Matcher<T> anything()
This matcher always evaluates to true.


anything

public static <T> Matcher<T> anything(java.lang.String description)
This matcher always evaluates to true.

Parameters:
description - A meaningful string used when describing itself.

hasItem

public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(Matcher<? super T> elementMatcher)

hasItem

public static <T> Matcher<java.lang.Iterable<? super T>> hasItem(T element)

hasItems

public static <T> Matcher<java.lang.Iterable<T>> hasItems(Matcher<? super T>... param1)

hasItems

public static <T> Matcher<java.lang.Iterable<T>> hasItems(T... param1)

equalTo

public static <T> Matcher<? super T> equalTo(T operand)
Is the value equal to another value, as tested by the Object.equals(java.lang.Object) invokedMethod?


any

public static <T> Matcher<T> any(java.lang.Class<T> type)
Is the value an instance of a particular type? Use this version to make generics conform, for example in the JMock clause with(any(Thing.class))


instanceOf

public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
Is the value an instance of a particular type? This version assumes no relationship between the required type and the signature of the method that sets it up, for example in assertThat(anObject, instanceOf(Thing.class));


not

public static <T> Matcher<T> not(Matcher<T> matcher)
Inverts the rule.


not

public static <T> Matcher<? super T> not(T value)
This is a shortcut to the frequently used not(equalTo(x)). For example: assertThat(cheese, is(not(equalTo(smelly)))) vs. assertThat(cheese, is(not(smelly)))


nullValue

public static <T> Matcher<T> nullValue()
Matches if value is null.


nullValue

public static <T> Matcher<T> nullValue(java.lang.Class<T> type)
Matches if value is null. With type inference.


notNullValue

public static <T> Matcher<T> notNullValue()
Matches if value is not null.


notNullValue

public static <T> Matcher<T> notNullValue(java.lang.Class<T> type)
Matches if value is not null. With type inference.


sameInstance

public static <T> Matcher<T> sameInstance(T object)
Creates a new instance of IsSame

Parameters:
object - The predicate evaluates to true only when the argument is this object.

containsString

public static Matcher<java.lang.String> containsString(java.lang.String substring)

startsWith

public static Matcher<java.lang.String> startsWith(java.lang.String substring)

endsWith

public static Matcher<java.lang.String> endsWith(java.lang.String substring)

array

public static <T> IsArray<T> array(Matcher<? super T>... param1)

hasItemInArray

public static <T> Matcher<T[]> hasItemInArray(Matcher<? super T> elementMatcher)
Evaluates to true if any item in an array satisfies the given matcher.


hasItemInArray

public static <T> Matcher<T[]> hasItemInArray(T element)
This is a shortcut to the frequently used hasItemInArray(equalTo(x)). For example, assertThat(hasItemInArray(equal_to(x))) vs. assertThat(hasItemInArray(x))


arrayContaining

public static <E> Matcher<E[]> arrayContaining(E... param1)

arrayContaining

public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... param1)

arrayContaining

public static <E> Matcher<E[]> arrayContaining(java.util.List<Matcher<? super E>> matchers)

arrayContainingInAnyOrder

public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... param1)

arrayContainingInAnyOrder

public static <E> Matcher<E[]> arrayContainingInAnyOrder(java.util.Collection<Matcher<? super E>> matchers)

arrayContainingInAnyOrder

public static <E> Matcher<E[]> arrayContainingInAnyOrder(E... param1)

arrayWithSize

public static <E> Matcher<E[]> arrayWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
Does array size satisfy a given matcher?


arrayWithSize

public static <E> Matcher<E[]> arrayWithSize(int size)
This is a shortcut to the frequently used arrayWithSize(equalTo(x)). For example, assertThat(arrayWithSize(equal_to(x))) vs. assertThat(arrayWithSize(x))


emptyArray

public static <E> Matcher<E[]> emptyArray()
Matches an empty array.


hasSize

public static <E> Matcher<? super java.util.Collection<? extends E>> hasSize(Matcher<? super java.lang.Integer> size)
Does collection size satisfy a given matcher?


hasSize

public static <E> Matcher<? super java.util.Collection<? extends E>> hasSize(int size)
This is a shortcut to the frequently used hasSize(equalTo(x)). For example, assertThat(hasSize(equal_to(x))) vs. assertThat(hasSize(x))


empty

public static <E> Matcher<java.util.Collection<E>> empty()
Matches an empty collection.


emptyIterable

public static <E> Matcher<java.lang.Iterable<E>> emptyIterable()
Matches an empty iterable.


contains

public static <E> Matcher<java.lang.Iterable<E>> contains(E... param1)

contains

public static <E> Matcher<java.lang.Iterable<E>> contains(Matcher<E> item)

contains

public static <E> Matcher<java.lang.Iterable<E>> contains(Matcher<? super E>... item)

contains

public static <E> Matcher<java.lang.Iterable<E>> contains(java.util.List<Matcher<? super E>> contents)

containsInAnyOrder

public static <E> Matcher<java.lang.Iterable<E>> containsInAnyOrder(Matcher<E> item)

containsInAnyOrder

public static <T> Matcher<java.lang.Iterable<T>> containsInAnyOrder(Matcher<? super T>... item)

containsInAnyOrder

public static <T> Matcher<java.lang.Iterable<T>> containsInAnyOrder(T... param1)

containsInAnyOrder

public static <T> Matcher<java.lang.Iterable<T>> containsInAnyOrder(java.util.Collection<Matcher<? super T>> matchers)

iterableWithSize

public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(Matcher<? super java.lang.Integer> sizeMatcher)

iterableWithSize

public static <E> Matcher<java.lang.Iterable<E>> iterableWithSize(int size)

hasEntry

public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher,
                                                                             Matcher<? super V> valueMatcher)

hasEntry

public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key,
                                                                             V value)

hasKey

public static <K> Matcher<java.util.Map<? super K,?>> hasKey(K key)

hasKey

public static <K> Matcher<java.util.Map<? super K,?>> hasKey(Matcher<? super K> keyMatcher)

hasValue

public static <V> Matcher<? super java.util.Map<?,V>> hasValue(V value)

hasValue

public static <V> Matcher<? super java.util.Map<?,V>> hasValue(Matcher<? super V> valueMatcher)

isIn

public static <T> Matcher<T> isIn(java.util.Collection<T> collection)

isIn

public static <T> Matcher<T> isIn(T[] param1)

isOneOf

public static <T> Matcher<T> isOneOf(T... param1)

closeTo

public static Matcher<java.lang.Double> closeTo(double operand,
                                                double error)

comparesEqualTo

public static <T extends java.lang.Comparable<T>> Matcher<? super T> comparesEqualTo(T value)
Is value = expected?


greaterThan

public static <T extends java.lang.Comparable<T>> Matcher<? super T> greaterThan(T value)
Is value > expected?


greaterThanOrEqualTo

public static <T extends java.lang.Comparable<T>> Matcher<? super T> greaterThanOrEqualTo(T value)
Is value >= expected?


lessThan

public static <T extends java.lang.Comparable<T>> Matcher<? super T> lessThan(T value)
Is value < expected?


lessThanOrEqualTo

public static <T extends java.lang.Comparable<T>> Matcher<? super T> lessThanOrEqualTo(T value)
Is value <= expected?


equalToIgnoringCase

public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String string)

equalToIgnoringWhiteSpace

public static Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String string)

hasToString

public static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
Evaluates whether item.toString() satisfies a given matcher.


hasToString

public static <T> Matcher<T> hasToString(java.lang.String expectedToString)
This is a shortcut to the frequently used has_string(equalTo(x)). For example, assertThat(hasToString(equal_to(x))) vs. assertThat(hasToString(x))


typeCompatibleWith

public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)

eventFrom

public 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.


eventFrom

public 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 .


hasProperty

public static <T> Matcher<T> hasProperty(java.lang.String propertyName)

hasProperty

public static <T> Matcher<T> hasProperty(java.lang.String propertyName,
                                         Matcher<?> value)

samePropertyValuesAs

public static <T> Matcher<T> samePropertyValuesAs(T expectedBean)

hasXPath

public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
                                                 Matcher<? super java.lang.String> valueMatcher)

hasXPath

public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
                                                 javax.xml.namespace.NamespaceContext namespaceContext,
                                                 Matcher<? super java.lang.String> valueMatcher)

hasXPath

public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath)

hasXPath

public static Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath,
                                                 javax.xml.namespace.NamespaceContext namespaceContext)