Package | Description |
---|---|
org.hamcrest | |
org.hamcrest.beans |
Matchers of Java Bean properties and their values.
|
org.hamcrest.collection |
Matchers of arrays and collections.
|
org.hamcrest.comparator | |
org.hamcrest.core |
Fundamental matchers of objects and values, and composite matchers.
|
org.hamcrest.internal | |
org.hamcrest.io | |
org.hamcrest.number |
Matchers that perform numeric comparisons.
|
org.hamcrest.object |
Matchers that inspect objects and classes.
|
org.hamcrest.text |
Matchers that perform text comparisons.
|
org.hamcrest.xml |
Matchers of XML documents.
|
Modifier and Type | Class and Description |
---|---|
class |
BaseMatcher<T>
BaseClass for all Matcher implementations.
|
class |
CustomMatcher<T>
Utility class for writing one off matchers.
|
class |
CustomTypeSafeMatcher<T>
Utility class for writing one off matchers.
|
class |
DiagnosingMatcher<T>
TODO(ngd): Document.
|
class |
FeatureMatcher<T,U>
Supporting class for matching a feature of an object.
|
class |
TypeSafeDiagnosingMatcher<T>
Convenient base class for Matchers that require a non-null value of a specific type
and that will report why the received value has been rejected.
|
class |
TypeSafeMatcher<T>
Convenient base class for Matchers that require a non-null value of a specific type.
|
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
Matchers.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
CoreMatchers.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
CoreMatchers.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.aMapWithSize(int size)
Creates a matcher for
Map s that matches when the size() method returns
a value equal to the specified size . |
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.aMapWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Map s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.anEmptyMap()
Creates a matcher for
Map s that matches when the size() method returns
zero. |
static <T> Matcher<T> |
Matchers.any(Class<T> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static <T> Matcher<T> |
CoreMatchers.any(Class<T> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static Matcher<Object> |
Matchers.anything()
Creates a matcher that always matches, regardless of the examined object.
|
static Matcher<Object> |
CoreMatchers.anything()
Creates a matcher that always matches, regardless of the examined object.
|
static Matcher<Object> |
Matchers.anything(String description)
Creates a matcher that always matches, regardless of the examined object, but describes
itself with the specified
String . |
static Matcher<Object> |
CoreMatchers.anything(String description)
Creates a matcher that always matches, regardless of the examined object, but describes
itself with the specified
String . |
static <E> Matcher<E[]> |
Matchers.arrayContaining(E... items)
Creates a matcher for arrays that matches when each item in the examined array is
logically equal to the corresponding item in the specified items.
|
static <E> Matcher<E[]> |
Matchers.arrayContaining(List<Matcher<? super E>> itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified list of matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContaining(Matcher<? super E>... itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified collection of matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContainingInAnyOrder(E... items)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array is logically equal to one item anywhere in the specified items.
|
static <E> Matcher<E[]> |
Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayWithSize(int size)
Creates a matcher for arrays that matches when the
length of the array
equals the specified size . |
static <E> Matcher<E[]> |
Matchers.arrayWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for arrays that matches when the
length of the array
satisfies the specified matcher. |
static Matcher<String> |
Matchers.blankOrNullString()
Creates a matcher of
String that matches when the examined string is null , or
contains zero or more whitespace characters and nothing else. |
static Matcher<String> |
Matchers.blankString()
Creates a matcher of
String that matches when the examined string contains
zero or more whitespace characters and nothing else. |
static Matcher<BigDecimal> |
Matchers.closeTo(BigDecimal operand,
BigDecimal error)
Creates a matcher of
BigDecimal s that matches when an examined BigDecimal is equal
to the specified operand , within a range of +/- error . |
static Matcher<Double> |
Matchers.closeTo(double operand,
double error)
Creates a matcher of
Double s that matches when an examined double is equal
to the specified operand , within a range of +/- error . |
static <T extends Comparable<T>> |
Matchers.comparesEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
equal to the specified value, as reported by the compareTo method of the
examined object. |
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(E... items)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(List<Matcher<? super E>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(Matcher<? super E>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(Matcher<? super E> itemMatcher)
|
static <T> Matcher<Iterable<? extends T>> |
Matchers.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
Matchers.containsInAnyOrder(T... items)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.containsInRelativeOrder(E... items)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.containsInRelativeOrder(Matcher<? super E>... itemMatchers)
|
static Matcher<String> |
Matchers.containsString(String substring)
|
static Matcher<String> |
CoreMatchers.containsString(String substring)
|
static Matcher<String> |
Matchers.containsStringIgnoringCase(String substring)
|
static Matcher<String> |
CoreMatchers.containsStringIgnoringCase(String substring)
|
static <T> Matcher<T> |
Matchers.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static <T> Matcher<T> |
CoreMatchers.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static <E> Matcher<Collection<? extends E>> |
Matchers.empty()
|
static <E> Matcher<E[]> |
Matchers.emptyArray()
Creates a matcher for arrays that matches when the
length of the array
is zero. |
static <E> Matcher<Collection<E>> |
Matchers.emptyCollectionOf(Class<E> unusedToForceReturnType)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.emptyIterable()
Creates a matcher for
Iterable s matching examined iterables that yield no items. |
static <E> Matcher<Iterable<E>> |
Matchers.emptyIterableOf(Class<E> unusedToForceReturnType)
Creates a matcher for
Iterable s matching examined iterables that yield no items. |
static Matcher<String> |
Matchers.emptyOrNullString()
Creates a matcher of
String that matches when the examined string is null , or
has zero length. |
static Matcher<String> |
Matchers.emptyString()
Creates a matcher of
String that matches when the examined string has zero length. |
static Matcher<String> |
Matchers.endsWith(String suffix)
|
static Matcher<String> |
CoreMatchers.endsWith(String suffix)
|
static Matcher<String> |
Matchers.endsWithIgnoringCase(String suffix)
|
static Matcher<String> |
CoreMatchers.endsWithIgnoringCase(String suffix)
|
static <T> Matcher<T> |
Matchers.equalTo(T operand)
Creates a matcher that matches when the examined object is logically equal to the specified
operand , as determined by calling the Object.equals(java.lang.Object) method on
the examined object. |
static <T> Matcher<T> |
CoreMatchers.equalTo(T operand)
Creates a matcher that matches when the examined object is logically equal to the specified
operand , as determined by calling the Object.equals(java.lang.Object) method on
the examined object. |
static Matcher<String> |
Matchers.equalToCompressingWhiteSpace(String expectedString)
Creates a matcher of
String that matches when the examined string is equal to
the specified expectedString, when whitespace differences are (mostly) ignored. |
static Matcher<String> |
Matchers.equalToIgnoringCase(String expectedString)
Creates a matcher of
String that matches when the examined string is equal to
the specified expectedString, ignoring case. |
static Matcher<String> |
Matchers.equalToIgnoringWhiteSpace(String expectedString)
Deprecated.
|
static Matcher<Object> |
Matchers.equalToObject(Object operand)
Creates an
IsEqual matcher that does not enforce the values being
compared to be of the same static type. |
static Matcher<Object> |
CoreMatchers.equalToObject(Object operand)
Creates an
IsEqual matcher that does not enforce the values being
compared to be of the same static type. |
static Matcher<EventObject> |
Matchers.eventFrom(Class<? extends EventObject> eventClass,
Object source)
Creates a matcher of
EventObject that matches any object
derived from eventClass announced by source. |
static Matcher<EventObject> |
Matchers.eventFrom(Object source)
Creates a matcher of
EventObject that matches any EventObject
announced by source. |
static <U> Matcher<Iterable<? extends U>> |
Matchers.everyItem(Matcher<U> itemMatcher)
|
static <U> Matcher<Iterable<? extends U>> |
CoreMatchers.everyItem(Matcher<U> itemMatcher)
|
static <T extends Comparable<T>> |
Matchers.greaterThan(T value)
Creates a matcher of
Comparable object that matches when the examined object is
greater than the specified value, as reported by the compareTo method of the
examined object. |
static <T extends Comparable<T>> |
Matchers.greaterThanOrEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
greater than or equal to the specified value, as reported by the compareTo method
of the examined object. |
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.hasEntry(K key,
V value)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <T> Matcher<Iterable<? super T>> |
Matchers.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
CoreMatchers.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
Matchers.hasItem(T item)
|
static <T> Matcher<Iterable<? super T>> |
CoreMatchers.hasItem(T item)
|
static <T> Matcher<T[]> |
Matchers.hasItemInArray(Matcher<? super T> elementMatcher)
Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified
elementMatcher . |
static <T> Matcher<T[]> |
Matchers.hasItemInArray(T element)
A shortcut to the frequently used
hasItemInArray(equalTo(x)) . |
static <T> Matcher<Iterable<T>> |
Matchers.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
CoreMatchers.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
Matchers.hasItems(T... items)
|
static <T> Matcher<Iterable<T>> |
CoreMatchers.hasItems(T... items)
|
static <K> Matcher<Map<? extends K,?>> |
Matchers.hasKey(K key)
|
static <K> Matcher<Map<? extends K,?>> |
Matchers.hasKey(Matcher<? super K> keyMatcher)
|
static Matcher<CharSequence> |
Matchers.hasLength(int length)
Creates a matcher of
CharSequence that matches when a char sequence has the length
of the specified argument . |
static <T> Matcher<T> |
Matchers.hasProperty(String propertyName)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name.
|
static <T> Matcher<T> |
Matchers.hasProperty(String propertyName,
Matcher<?> valueMatcher)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name whose value satisfies the specified matcher.
|
static <E> Matcher<Collection<? extends E>> |
Matchers.hasSize(int size)
Creates a matcher for
Collection s that matches when the size() method returns
a value equal to the specified size . |
static <E> Matcher<Collection<? extends E>> |
Matchers.hasSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Collection s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <T> Matcher<T> |
Matchers.hasToString(Matcher<? super String> toStringMatcher)
Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher. |
static <T> Matcher<T> |
Matchers.hasToString(String expectedToString)
Creates a matcher that matches any examined object whose
toString method
returns a value equalTo the specified string. |
static <V> Matcher<Map<?,? extends V>> |
Matchers.hasValue(Matcher<? super V> valueMatcher)
|
static <V> Matcher<Map<?,? extends V>> |
Matchers.hasValue(V value)
|
static Matcher<Node> |
Matchers.hasXPath(String xPath)
Creates a matcher of
Node s that matches when the examined node contains a node
at the specified xPath , with any content. |
static Matcher<Node> |
Matchers.hasXPath(String xPath,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath that satisfies the specified valueMatcher . |
static Matcher<Node> |
Matchers.hasXPath(String xPath,
NamespaceContext namespaceContext)
Creates a matcher of
Node s that matches when the examined node contains a node
at the specified xPath within the specified namespace context, with any content. |
static Matcher<Node> |
Matchers.hasXPath(String xPath,
NamespaceContext namespaceContext,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath , within the specified namespaceContext , that satisfies
the specified valueMatcher . |
static <T> Matcher<T> |
Matchers.in(Collection<T> collection)
Creates a matcher that matches when the examined object is found within the
specified collection.
|
static <T> Matcher<T> |
Matchers.in(T[] elements)
Creates a matcher that matches when the examined object is found within the
specified array.
|
static <T> Matcher<T> |
Matchers.instanceOf(Class<?> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static <T> Matcher<T> |
CoreMatchers.instanceOf(Class<?> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static <T> Matcher<T> |
Matchers.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <T> Matcher<T> |
CoreMatchers.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <T> Matcher<T> |
Matchers.is(T value)
A shortcut to the frequently used
is(equalTo(x)) . |
static <T> Matcher<T> |
CoreMatchers.is(T value)
A shortcut to the frequently used
is(equalTo(x)) . |
static <T> Matcher<T> |
Matchers.isA(Class<?> type)
A shortcut to the frequently used
is(instanceOf(SomeClass.class)) . |
static <T> Matcher<T> |
CoreMatchers.isA(Class<T> type)
A shortcut to the frequently used
is(instanceOf(SomeClass.class)) . |
static Matcher<String> |
Matchers.isEmptyOrNullString()
Deprecated.
use is(emptyOrNullString()) instead
|
static Matcher<String> |
Matchers.isEmptyString()
Deprecated.
use is(emptyString()) instead
|
static <T> Matcher<T> |
Matchers.isIn(Collection<T> collection)
Deprecated.
use is(in(...)) instead
|
static <T> Matcher<T> |
Matchers.isIn(T[] elements)
Deprecated.
use is(in(...)) instead
|
static <T> Matcher<T> |
Matchers.isOneOf(T... elements)
Deprecated.
use is(oneOf(...)) instead
|
static <E> Matcher<Iterable<E>> |
Matchers.iterableWithSize(int size)
|
static <E> Matcher<Iterable<E>> |
Matchers.iterableWithSize(Matcher<? super Integer> sizeMatcher)
|
static <T extends Comparable<T>> |
Matchers.lessThan(T value)
Creates a matcher of
Comparable object that matches when the examined object is
less than the specified value, as reported by the compareTo method of the
examined object. |
static <T extends Comparable<T>> |
Matchers.lessThanOrEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
less than or equal to the specified value, as reported by the compareTo method
of the examined object. |
static Matcher<String> |
Matchers.matchesPattern(Pattern pattern)
|
static Matcher<String> |
Matchers.matchesPattern(String regex)
|
static Matcher<String> |
Matchers.matchesRegex(Pattern pattern)
Validate a string with a
Pattern . |
static Matcher<String> |
Matchers.matchesRegex(String regex)
Validate a string with a regex.
|
static <T> Matcher<T> |
Matchers.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
static <T> Matcher<T> |
CoreMatchers.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
static <T> Matcher<T> |
Matchers.not(T value)
A shortcut to the frequently used
not(equalTo(x)) . |
static <T> Matcher<T> |
CoreMatchers.not(T value)
A shortcut to the frequently used
not(equalTo(x)) . |
static Matcher<Double> |
Matchers.notANumber()
Creates a matcher of
Double s that matches when an examined double is not a number. |
static Matcher<Object> |
Matchers.notNullValue()
A shortcut to the frequently used
not(nullValue()) . |
static Matcher<Object> |
CoreMatchers.notNullValue()
A shortcut to the frequently used
not(nullValue()) . |
static <T> Matcher<T> |
Matchers.notNullValue(Class<T> type)
A shortcut to the frequently used
not(nullValue(X.class)). |
static <T> Matcher<T> |
CoreMatchers.notNullValue(Class<T> type)
A shortcut to the frequently used
not(nullValue(X.class)). |
static Matcher<Object> |
Matchers.nullValue()
Creates a matcher that matches if examined object is
null . |
static Matcher<Object> |
CoreMatchers.nullValue()
Creates a matcher that matches if examined object is
null . |
static <T> Matcher<T> |
Matchers.nullValue(Class<T> type)
Creates a matcher that matches if examined object is
null . |
static <T> Matcher<T> |
CoreMatchers.nullValue(Class<T> type)
Creates a matcher that matches if examined object is
null . |
static <T> Matcher<T> |
Matchers.oneOf(T... elements)
Creates a matcher that matches when the examined object is equal to one of the
specified elements.
|
static <T> Matcher<T> |
Matchers.sameInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
static <T> Matcher<T> |
CoreMatchers.sameInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
static <B> Matcher<B> |
Matchers.samePropertyValuesAs(B expectedBean,
String... ignoredProperties)
Creates a matcher that matches when the examined object has values for all of
its JavaBean properties that are equal to the corresponding values of the
specified bean.
|
static Matcher<String> |
Matchers.startsWith(String prefix)
|
static Matcher<String> |
CoreMatchers.startsWith(String prefix)
|
static Matcher<String> |
Matchers.startsWithIgnoringCase(String prefix)
|
static Matcher<String> |
CoreMatchers.startsWithIgnoringCase(String prefix)
|
static Matcher<String> |
Matchers.stringContainsInOrder(Iterable<String> substrings)
Creates a matcher of
String that matches when the examined string contains all of
the specified substrings, considering the order of their appearance. |
static Matcher<String> |
Matchers.stringContainsInOrder(String... substrings)
Creates a matcher of
String that matches when the examined string contains all of
the specified substrings, considering the order of their appearance. |
static <T> Matcher<T> |
Matchers.theInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
static <T> Matcher<T> |
CoreMatchers.theInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
static <T> Matcher<Class<?>> |
Matchers.typeCompatibleWith(Class<T> baseType)
Creates a matcher of
Class that matches when the specified baseType is
assignable from the examined class. |
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
CoreMatchers.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.allOf(Matcher<? super 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 ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
Matchers.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)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.aMapWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Map s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
CoreMatchers.anyOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super T> first,
Matcher<? super T> second)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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 <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> AnyOf<T> |
Matchers.anyOf(Matcher<? super 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.
|
static <T> IsArray<T> |
Matchers.array(Matcher<? super T>... elementMatchers)
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContaining(Matcher<? super E>... itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for arrays that matches when the
length of the array
satisfies the specified matcher. |
static <T> void |
MatcherAssert.assertThat(String reason,
T actual,
Matcher<? super T> matcher) |
static <T> void |
MatcherAssert.assertThat(T actual,
Matcher<? super T> matcher) |
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
Matchers.both(Matcher<? super LHS> matcher)
Creates a matcher that matches when both of the specified matchers match the examined object.
|
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
CoreMatchers.both(Matcher<? super LHS> matcher)
Creates a matcher that matches when both of the specified matchers match the examined object.
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(Matcher<? super E>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(Matcher<? super E> itemMatcher)
|
static <T> Matcher<Iterable<? extends T>> |
Matchers.containsInAnyOrder(Matcher<? super T>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.containsInRelativeOrder(Matcher<? super E>... itemMatchers)
|
static <T> Matcher<T> |
Matchers.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static <T> Matcher<T> |
CoreMatchers.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
Matchers.either(Matcher<? super LHS> matcher)
Creates a matcher that matches when either of the specified matchers match the examined object.
|
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
CoreMatchers.either(Matcher<? super LHS> matcher)
Creates a matcher that matches when either of the specified matchers match the examined object.
|
static <U> Matcher<Iterable<? extends U>> |
Matchers.everyItem(Matcher<U> itemMatcher)
|
static <U> Matcher<Iterable<? extends U>> |
CoreMatchers.everyItem(Matcher<U> itemMatcher)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
Matchers.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <T> Matcher<Iterable<? super T>> |
Matchers.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
CoreMatchers.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<T[]> |
Matchers.hasItemInArray(Matcher<? super T> elementMatcher)
Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified
elementMatcher . |
static <T> Matcher<Iterable<T>> |
Matchers.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
CoreMatchers.hasItems(Matcher<? super T>... itemMatchers)
|
static <K> Matcher<Map<? extends K,?>> |
Matchers.hasKey(Matcher<? super K> keyMatcher)
|
static <T> Matcher<T> |
Matchers.hasProperty(String propertyName,
Matcher<?> valueMatcher)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name whose value satisfies the specified matcher.
|
static <E> Matcher<Collection<? extends E>> |
Matchers.hasSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Collection s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <T> Matcher<T> |
Matchers.hasToString(Matcher<? super String> toStringMatcher)
Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher. |
static <V> Matcher<Map<?,? extends V>> |
Matchers.hasValue(Matcher<? super V> valueMatcher)
|
static Matcher<Node> |
Matchers.hasXPath(String xPath,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath that satisfies the specified valueMatcher . |
static Matcher<Node> |
Matchers.hasXPath(String xPath,
NamespaceContext namespaceContext,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath , within the specified namespaceContext , that satisfies
the specified valueMatcher . |
static <T> Matcher<T> |
Matchers.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <T> Matcher<T> |
CoreMatchers.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <E> Matcher<Iterable<E>> |
Matchers.iterableWithSize(Matcher<? super Integer> sizeMatcher)
|
boolean |
Condition.matching(Matcher<T> match) |
abstract boolean |
Condition.matching(Matcher<T> match,
String message) |
static <T> Matcher<T> |
Matchers.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
static <T> Matcher<T> |
CoreMatchers.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
Matchers.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
CoreMatchers.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> AnyOf<T> |
Matchers.anyOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
CoreMatchers.anyOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContaining(List<Matcher<? super E>> itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified list of matchers.
|
static <E> Matcher<E[]> |
Matchers.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified collection of matchers.
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.contains(List<Matcher<? super E>> itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
Matchers.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
Matchers.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers)
|
Constructor and Description |
---|
FeatureMatcher(Matcher<? super U> subMatcher,
String featureDescription,
String featureName)
Constructor
|
Modifier and Type | Class and Description |
---|---|
class |
HasProperty<T>
A Matcher that checks that an object has a JavaBean property
with the specified name.
|
class |
HasPropertyWithValue<T>
Matcher that asserts that a JavaBean property on an argument passed to the
mock object meets the provided matcher.
|
class |
SamePropertyValuesAs<T> |
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
HasProperty.hasProperty(String propertyName)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name.
|
static <T> Matcher<T> |
HasPropertyWithValue.hasProperty(String propertyName,
Matcher<?> valueMatcher)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name whose value satisfies the specified matcher.
|
static <T> Matcher<T> |
HasPropertyWithValue.hasPropertyAtPath(String path,
Matcher<T> valueMatcher)
Creates a matcher that matches when the examined object is a graph of
JavaBean objects that can be navigated along the declared dot-separated path
and the final element of that path is a JavaBean property whose value satisfies the
specified matcher.
|
static <B> Matcher<B> |
SamePropertyValuesAs.samePropertyValuesAs(B expectedBean,
String... ignoredProperties)
Creates a matcher that matches when the examined object has values for all of
its JavaBean properties that are equal to the corresponding values of the
specified bean.
|
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
HasPropertyWithValue.hasProperty(String propertyName,
Matcher<?> valueMatcher)
Creates a matcher that matches when the examined object has a JavaBean property
with the specified name whose value satisfies the specified matcher.
|
static <T> Matcher<T> |
HasPropertyWithValue.hasPropertyAtPath(String path,
Matcher<T> valueMatcher)
Creates a matcher that matches when the examined object is a graph of
JavaBean objects that can be navigated along the declared dot-separated path
and the final element of that path is a JavaBean property whose value satisfies the
specified matcher.
|
Constructor and Description |
---|
HasPropertyWithValue(String propertyName,
Matcher<?> valueMatcher) |
HasPropertyWithValue(String propertyName,
Matcher<?> valueMatcher,
String messageFormat) |
Modifier and Type | Class and Description |
---|---|
class |
ArrayAsIterableMatcher<E> |
class |
HasItemInArray<T>
Matches if an array contains an item satisfying a nested matcher.
|
class |
IsArray<T>
Matcher for array whose elements satisfy a sequence of matchers.
|
class |
IsArrayContainingInAnyOrder<E>
Deprecated.
As of release 2.1, replaced by
ArrayMatching . |
class |
IsArrayContainingInOrder<E>
Deprecated.
As of release 2.1, replaced by
ArrayMatching . |
class |
IsArrayWithSize<E>
Matches if array size satisfies a nested matcher.
|
class |
IsCollectionWithSize<E>
Matches if collection size satisfies a nested matcher.
|
class |
IsEmptyCollection<E>
Tests if collection is empty.
|
class |
IsEmptyIterable<E>
Tests if collection is empty.
|
class |
IsIn<T> |
class |
IsIterableContainingInAnyOrder<T> |
class |
IsIterableContainingInOrder<E> |
class |
IsIterableContainingInRelativeOrder<E> |
class |
IsIterableWithSize<E> |
class |
IsMapContaining<K,V> |
class |
IsMapWithSize<K,V>
Matches if map size satisfies a nested matcher.
|
Modifier and Type | Field and Description |
---|---|
protected Collection<Matcher<? super E>> |
ArrayAsIterableMatcher.matchers |
Modifier and Type | Method and Description |
---|---|
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapWithSize.aMapWithSize(int size)
Creates a matcher for
Map s that matches when the size() method returns
a value equal to the specified size . |
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapWithSize.aMapWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Map s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapWithSize.anEmptyMap()
Creates a matcher for
Map s that matches when the size() method returns
zero. |
static <E> Matcher<E[]> |
ArrayMatching.arrayContaining(E... items)
Creates a matcher for arrays that matches when each item in the examined array is
logically equal to the corresponding item in the specified items.
|
static <E> Matcher<E[]> |
IsArrayContainingInOrder.arrayContaining(E... items)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContaining(Object[]) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContaining(List<Matcher<? super E>> itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified list of matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInOrder.arrayContaining(List<Matcher<? super E>> itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContaining(List) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContaining(Matcher<? super E>... itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContaining(Matcher[]) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified collection of matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContainingInAnyOrder(Collection) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContainingInAnyOrder(E... items)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array is logically equal to one item anywhere in the specified items.
|
static <E> Matcher<E[]> |
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(E... items)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContainingInAnyOrder(Object[]) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContainingInAnyOrder(Matcher[]) . |
static <E> Matcher<E[]> |
IsArrayWithSize.arrayWithSize(int size)
Creates a matcher for arrays that matches when the
length of the array
equals the specified size . |
static <E> Matcher<E[]> |
IsArrayWithSize.arrayWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for arrays that matches when the
length of the array
satisfies the specified matcher. |
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(E... items)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(List<Matcher<? super E>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher)
|
static <T> Matcher<Iterable<? extends T>> |
IsIterableContainingInAnyOrder.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
IsIterableContainingInAnyOrder.containsInAnyOrder(T... items)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInRelativeOrder.containsInRelativeOrder(E... items)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInRelativeOrder.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInRelativeOrder.containsInRelativeOrder(Matcher<? super E>... itemMatchers)
|
static <E> Matcher<Collection<? extends E>> |
IsEmptyCollection.empty()
|
static <E> Matcher<E[]> |
IsArrayWithSize.emptyArray()
Creates a matcher for arrays that matches when the
length of the array
is zero. |
static <E> Matcher<Collection<E>> |
IsEmptyCollection.emptyCollectionOf(Class<E> unusedToForceReturnType)
|
static <E> Matcher<Iterable<? extends E>> |
IsEmptyIterable.emptyIterable()
Creates a matcher for
Iterable s matching examined iterables that yield no items. |
static <E> Matcher<Iterable<E>> |
IsEmptyIterable.emptyIterableOf(Class<E> unusedToForceReturnType)
Creates a matcher for
Iterable s matching examined iterables that yield no items. |
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapContaining.hasEntry(K key,
V value)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <T> Matcher<T[]> |
ArrayMatching.hasItemInArray(Matcher<? super T> elementMatcher)
Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified
elementMatcher . |
static <T> Matcher<T[]> |
ArrayMatching.hasItemInArray(T element)
A shortcut to the frequently used
hasItemInArray(equalTo(x)) . |
static <K> Matcher<Map<? extends K,?>> |
IsMapContaining.hasKey(K key)
|
static <K> Matcher<Map<? extends K,?>> |
IsMapContaining.hasKey(Matcher<? super K> keyMatcher)
|
static <E> Matcher<Collection<? extends E>> |
IsCollectionWithSize.hasSize(int size)
Creates a matcher for
Collection s that matches when the size() method returns
a value equal to the specified size . |
static <E> Matcher<Collection<? extends E>> |
IsCollectionWithSize.hasSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Collection s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <V> Matcher<Map<?,? extends V>> |
IsMapContaining.hasValue(Matcher<? super V> valueMatcher)
|
static <V> Matcher<Map<?,? extends V>> |
IsMapContaining.hasValue(V value)
|
static <T> Matcher<T> |
IsIn.in(Collection<T> collection)
Creates a matcher that matches when the examined object is found within the
specified collection.
|
static <T> Matcher<T> |
IsIn.in(T[] elements)
Creates a matcher that matches when the examined object is found within the
specified array.
|
static <T> Matcher<T> |
IsIn.isIn(Collection<T> collection)
Deprecated.
use is(in(...)) instead
|
static <T> Matcher<T> |
IsIn.isIn(T[] elements)
Deprecated.
use is(in(...)) instead
|
static <T> Matcher<T> |
IsIn.isOneOf(T... elements)
Deprecated.
use is(oneOf(...)) instead
|
static <E> Matcher<Iterable<E>> |
IsIterableWithSize.iterableWithSize(int size)
|
static <E> Matcher<Iterable<E>> |
IsIterableWithSize.iterableWithSize(Matcher<? super Integer> sizeMatcher)
|
static <T> Matcher<T> |
IsIn.oneOf(T... elements)
Creates a matcher that matches when the examined object is equal to one of the
specified elements.
|
Modifier and Type | Method and Description |
---|---|
static <E> List<Matcher<? super E>> |
ArrayMatching.asEqualMatchers(E[] items) |
Modifier and Type | Method and Description |
---|---|
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapWithSize.aMapWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Map s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <T> IsArray<T> |
IsArray.array(Matcher<? super T>... elementMatchers)
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers.
|
static <E> Matcher<E[]> |
ArrayMatching.arrayContaining(Matcher<? super E>... itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInOrder.arrayContaining(Matcher<? super E>... itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContaining(Matcher[]) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContainingInAnyOrder(Matcher[]) . |
static <E> Matcher<E[]> |
IsArrayWithSize.arrayWithSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for arrays that matches when the
length of the array
satisfies the specified matcher. |
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(Matcher<? super E>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(Matcher<? super E> itemMatcher)
|
static <T> Matcher<Iterable<? extends T>> |
IsIterableContainingInAnyOrder.containsInAnyOrder(Matcher<? super T>... itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInRelativeOrder.containsInRelativeOrder(Matcher<? super E>... itemMatchers)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <K,V> Matcher<Map<? extends K,? extends V>> |
IsMapContaining.hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
static <T> Matcher<T[]> |
ArrayMatching.hasItemInArray(Matcher<? super T> elementMatcher)
Creates a matcher for arrays that matches when the examined array contains at least one item
that is matched by the specified
elementMatcher . |
static <K> Matcher<Map<? extends K,?>> |
IsMapContaining.hasKey(Matcher<? super K> keyMatcher)
|
static <E> Matcher<Collection<? extends E>> |
IsCollectionWithSize.hasSize(Matcher<? super Integer> sizeMatcher)
Creates a matcher for
Collection s that matches when the size() method returns
a value that satisfies the specified matcher. |
static <V> Matcher<Map<?,? extends V>> |
IsMapContaining.hasValue(Matcher<? super V> valueMatcher)
|
static <E> Matcher<Iterable<E>> |
IsIterableWithSize.iterableWithSize(Matcher<? super Integer> sizeMatcher)
|
Modifier and Type | Method and Description |
---|---|
static <E> Matcher<E[]> |
ArrayMatching.arrayContaining(List<Matcher<? super E>> itemMatchers)
Creates a matcher for arrays that matches when each item in the examined array satisfies the
corresponding matcher in the specified list of matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInOrder.arrayContaining(List<Matcher<? super E>> itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContaining(List) . |
static <E> Matcher<E[]> |
ArrayMatching.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Creates an order agnostic matcher for arrays that matches when each item in the
examined array satisfies one matcher anywhere in the specified collection of matchers.
|
static <E> Matcher<E[]> |
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(Collection<Matcher<? super E>> itemMatchers)
Deprecated.
As of version 2.1, use
ArrayMatching.arrayContainingInAnyOrder(Collection) . |
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInOrder.contains(List<Matcher<? super E>> itemMatchers)
|
static <T> Matcher<Iterable<? extends T>> |
IsIterableContainingInAnyOrder.containsInAnyOrder(Collection<Matcher<? super T>> itemMatchers)
|
static <E> Matcher<Iterable<? extends E>> |
IsIterableContainingInRelativeOrder.containsInRelativeOrder(List<Matcher<? super E>> itemMatchers)
|
Constructor and Description |
---|
HasItemInArray(Matcher<? super T> elementMatcher) |
IsArray(Matcher<? super T>[] elementMatchers) |
IsArrayWithSize(Matcher<? super Integer> sizeMatcher) |
IsCollectionWithSize(Matcher<? super Integer> sizeMatcher) |
IsIterableWithSize(Matcher<? super Integer> sizeMatcher) |
IsMapContaining(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher) |
IsMapContaining(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher) |
IsMapWithSize(Matcher<? super Integer> sizeMatcher) |
Constructor and Description |
---|
ArrayAsIterableMatcher(TypeSafeDiagnosingMatcher<Iterable<? extends E>> iterableMatcher,
Collection<Matcher<? super E>> matchers,
String message) |
IsArrayContainingInAnyOrder(Collection<Matcher<? super E>> matchers)
Deprecated.
|
IsArrayContainingInOrder(List<Matcher<? super E>> matchers)
Deprecated.
|
IsIterableContainingInAnyOrder(Collection<Matcher<? super T>> matchers) |
IsIterableContainingInOrder(List<Matcher<? super E>> matchers) |
IsIterableContainingInRelativeOrder(List<Matcher<? super E>> matchers) |
Modifier and Type | Method and Description |
---|---|
Matcher<T> |
ComparatorMatcherBuilder.comparesEqualTo(T value)
Creates a matcher of
T object that matches when the examined object is
equal to the specified value, as reported by the Comparator used to
create this builder. |
Matcher<T> |
ComparatorMatcherBuilder.greaterThan(T value)
Creates a matcher of
T object that matches when the examined object is
greater than the specified value, as reported by the Comparator used to
create this builder. |
Matcher<T> |
ComparatorMatcherBuilder.greaterThanOrEqualTo(T value)
Creates a matcher of
T object that matches when the examined object is
greater than or equal to the specified value, as reported by the Comparator used to
create this builder. |
Matcher<T> |
ComparatorMatcherBuilder.lessThan(T value)
Creates a matcher of
T object that matches when the examined object is
less than the specified value, as reported by the Comparator used to
create this builder. |
Matcher<T> |
ComparatorMatcherBuilder.lessThanOrEqualTo(T value)
Creates a matcher of
T object that matches when the examined object is
less than or equal to the specified value, as reported by the Comparator used to
create this builder. |
Modifier and Type | Class and Description |
---|---|
class |
AllOf<T>
Calculates the logical conjunction of multiple matchers.
|
class |
AnyOf<T>
Calculates the logical disjunction of multiple matchers.
|
class |
CombinableMatcher<T> |
class |
DescribedAs<T>
Provides a custom description to another matcher.
|
class |
Every<T> |
class |
Is<T>
Decorates another Matcher, retaining the behaviour but allowing tests
to be slightly more expressive.
|
class |
IsAnything<T>
A matcher that always returns
true . |
class |
IsCollectionContaining<T>
Deprecated.
As of release 2.1, replaced by
IsIterableContaining . |
class |
IsEqual<T>
Is the value equal to another value, as tested by the
Object.equals(java.lang.Object) invokedMethod? |
class |
IsInstanceOf
Tests whether the value is an instance of a class.
|
class |
IsIterableContaining<T> |
class |
IsNot<T>
Calculates the logical negation of a matcher.
|
class |
IsNull<T>
Is the value null?
|
class |
IsSame<T>
Is the value the same object as another value?
|
class |
StringContains
Tests if the argument is a string that contains a specific substring.
|
class |
StringEndsWith
Tests if the argument is a string that ends with a specific substring.
|
class |
StringRegularExpression |
class |
StringStartsWith
Tests if the argument is a string that starts with a specific substring.
|
class |
SubstringMatcher |
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
AllOf.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
AllOf.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> Matcher<T> |
IsInstanceOf.any(Class<T> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static Matcher<Object> |
IsAnything.anything()
Creates a matcher that always matches, regardless of the examined object.
|
static Matcher<Object> |
IsAnything.anything(String description)
Creates a matcher that always matches, regardless of the examined object, but describes
itself with the specified
String . |
static Matcher<String> |
StringContains.containsString(String substring)
|
static Matcher<String> |
StringContains.containsStringIgnoringCase(String substring)
|
static <T> Matcher<T> |
DescribedAs.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static Matcher<String> |
StringEndsWith.endsWith(String suffix)
|
static Matcher<String> |
StringEndsWith.endsWithIgnoringCase(String suffix)
|
static <T> Matcher<T> |
IsEqual.equalTo(T operand)
Creates a matcher that matches when the examined object is logically equal to the specified
operand , as determined by calling the Object.equals(java.lang.Object) method on
the examined object. |
static Matcher<Object> |
IsEqual.equalToObject(Object operand)
Creates an
IsEqual matcher that does not enforce the values being
compared to be of the same static type. |
static <U> Matcher<Iterable<? extends U>> |
Every.everyItem(Matcher<U> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsIterableContaining.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItem(Matcher) . |
static <T> Matcher<Iterable<? super T>> |
IsIterableContaining.hasItem(T item)
|
static <T> Matcher<Iterable<? super T>> |
IsCollectionContaining.hasItem(T item)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItem(Object) . |
static <T> Matcher<Iterable<T>> |
IsIterableContaining.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItems(Matcher[]) }. |
static <T> Matcher<Iterable<T>> |
IsIterableContaining.hasItems(T... items)
|
static <T> Matcher<Iterable<T>> |
IsCollectionContaining.hasItems(T... items)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItems(Object[]) }. |
static <T> Matcher<T> |
IsInstanceOf.instanceOf(Class<?> type)
Creates a matcher that matches when the examined object is an instance of the specified
type ,
as determined by calling the Class.isInstance(Object) method on that type, passing the
the examined object. |
static <T> Matcher<T> |
Is.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <T> Matcher<T> |
Is.is(T value)
A shortcut to the frequently used
is(equalTo(x)) . |
static <T> Matcher<T> |
Is.isA(Class<?> type)
A shortcut to the frequently used
is(instanceOf(SomeClass.class)) . |
static Matcher<String> |
StringRegularExpression.matchesRegex(Pattern pattern)
Creates a matcher that checks if the examined string matches a specified
Pattern . |
static Matcher<String> |
StringRegularExpression.matchesRegex(String regex)
Creates a matcher that checks if the examined string matches a specified regex.
|
static <T> Matcher<T> |
IsNot.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
static <T> Matcher<T> |
IsNot.not(T value)
A shortcut to the frequently used
not(equalTo(x)) . |
static Matcher<Object> |
IsNull.notNullValue()
A shortcut to the frequently used
not(nullValue()) . |
static <T> Matcher<T> |
IsNull.notNullValue(Class<T> type)
A shortcut to the frequently used
not(nullValue(X.class)). |
static Matcher<Object> |
IsNull.nullValue()
Creates a matcher that matches if examined object is
null . |
static <T> Matcher<T> |
IsNull.nullValue(Class<T> type)
Creates a matcher that matches if examined object is
null . |
static <T> Matcher<T> |
IsSame.sameInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
static Matcher<String> |
StringStartsWith.startsWith(String prefix)
|
static Matcher<String> |
StringStartsWith.startsWithIgnoringCase(String prefix)
|
static <T> Matcher<T> |
IsSame.theInstance(T target)
Creates a matcher that matches only when the examined object is the same instance as
the specified target object.
|
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
AllOf.allOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
CombinableMatcher<T> |
CombinableMatcher.and(Matcher<? super T> other) |
CombinableMatcher<X> |
CombinableMatcher.CombinableBothMatcher.and(Matcher<? super X> other) |
static <T> AnyOf<T> |
AnyOf.anyOf(Matcher<? super T>... matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> |
CombinableMatcher.both(Matcher<? super LHS> matcher)
Creates a matcher that matches when both of the specified matchers match the examined object.
|
static <T> Matcher<T> |
DescribedAs.describedAs(String description,
Matcher<T> matcher,
Object... values)
Wraps an existing matcher, overriding its description with that specified.
|
static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> |
CombinableMatcher.either(Matcher<? super LHS> matcher)
Creates a matcher that matches when either of the specified matchers match the examined object.
|
static <U> Matcher<Iterable<? extends U>> |
Every.everyItem(Matcher<U> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsIterableContaining.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItem(Matcher) . |
static <T> Matcher<Iterable<T>> |
IsIterableContaining.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
Deprecated.
As of version 2.1, use
IsIterableContaining.hasItems(Matcher[]) }. |
static <T> Matcher<T> |
Is.is(Matcher<T> matcher)
Decorates another Matcher, retaining its behaviour, but allowing tests
to be slightly more expressive.
|
static <T> Matcher<T> |
IsNot.not(Matcher<T> matcher)
Creates a matcher that wraps an existing matcher, but inverts the logic by which
it will match.
|
CombinableMatcher<T> |
CombinableMatcher.or(Matcher<? super T> other) |
CombinableMatcher<X> |
CombinableMatcher.CombinableEitherMatcher.or(Matcher<? super X> other) |
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
AllOf.allOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ALL of the specified matchers.
|
static <T> AnyOf<T> |
AnyOf.anyOf(Iterable<Matcher<? super T>> matchers)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
Constructor and Description |
---|
AllOf(Matcher<? super T>... matchers) |
AnyOf(Matcher<? super T>... matchers) |
CombinableBothMatcher(Matcher<? super X> matcher) |
CombinableEitherMatcher(Matcher<? super X> matcher) |
CombinableMatcher(Matcher<? super T> matcher) |
DescribedAs(String descriptionTemplate,
Matcher<T> matcher,
Object[] values) |
Every(Matcher<? super T> matcher) |
Is(Matcher<T> matcher) |
IsCollectionContaining(Matcher<? super T> elementMatcher)
Deprecated.
|
IsIterableContaining(Matcher<? super T> elementMatcher) |
IsNot(Matcher<T> matcher) |
Constructor and Description |
---|
AllOf(Iterable<Matcher<? super T>> matchers) |
AnyOf(Iterable<Matcher<? super T>> matchers) |
Modifier and Type | Method and Description |
---|---|
static <E> List<Matcher<? super E>> |
NullSafety.nullSafe(Matcher<? super E>[] itemMatchers) |
Modifier and Type | Method and Description |
---|---|
static <E> List<Matcher<? super E>> |
NullSafety.nullSafe(Matcher<? super E>[] itemMatchers) |
Modifier and Type | Method and Description |
---|---|
static Matcher<File> |
FileMatchers.aFileNamed(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithAbsolutePath(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithCanonicalPath(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithSize(long size) |
static Matcher<File> |
FileMatchers.aFileWithSize(Matcher<Long> expected) |
static Matcher<File> |
FileMatchers.anExistingDirectory() |
static Matcher<File> |
FileMatchers.anExistingFile() |
static Matcher<File> |
FileMatchers.anExistingFileOrDirectory() |
static Matcher<File> |
FileMatchers.aReadableFile() |
static Matcher<File> |
FileMatchers.aWritableFile() |
Modifier and Type | Method and Description |
---|---|
static Matcher<File> |
FileMatchers.aFileNamed(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithAbsolutePath(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithCanonicalPath(Matcher<String> expected) |
static Matcher<File> |
FileMatchers.aFileWithSize(Matcher<Long> expected) |
Modifier and Type | Class and Description |
---|---|
class |
BigDecimalCloseTo |
class |
IsCloseTo
Is the value a number equal to a value within some range of
acceptable error?
|
class |
IsNaN
Is the value a number actually not a number (NaN)?
|
Modifier and Type | Method and Description |
---|---|
static Matcher<BigDecimal> |
BigDecimalCloseTo.closeTo(BigDecimal operand,
BigDecimal error)
Creates a matcher of
BigDecimal s that matches when an examined BigDecimal is equal
to the specified operand , within a range of +/- error . |
static Matcher<Double> |
IsCloseTo.closeTo(double operand,
double error)
Creates a matcher of
Double s that matches when an examined double is equal
to the specified operand , within a range of +/- error . |
static <T extends Comparable<T>> |
OrderingComparison.comparesEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
equal to the specified value, as reported by the compareTo method of the
examined object. |
static <T extends Comparable<T>> |
OrderingComparison.greaterThan(T value)
Creates a matcher of
Comparable object that matches when the examined object is
greater than the specified value, as reported by the compareTo method of the
examined object. |
static <T extends Comparable<T>> |
OrderingComparison.greaterThanOrEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
greater than or equal to the specified value, as reported by the compareTo method
of the examined object. |
static <T extends Comparable<T>> |
OrderingComparison.lessThan(T value)
Creates a matcher of
Comparable object that matches when the examined object is
less than the specified value, as reported by the compareTo method of the
examined object. |
static <T extends Comparable<T>> |
OrderingComparison.lessThanOrEqualTo(T value)
Creates a matcher of
Comparable object that matches when the examined object is
less than or equal to the specified value, as reported by the compareTo method
of the examined object. |
static Matcher<Double> |
IsNaN.notANumber()
Creates a matcher of
Double s that matches when an examined double is not a number. |
Modifier and Type | Class and Description |
---|---|
class |
HasEqualValues<T> |
class |
HasToString<T> |
class |
IsCompatibleType<T> |
class |
IsEventFrom
Tests if the value is an event announced by a specific object.
|
Modifier and Type | Method and Description |
---|---|
static Matcher<EventObject> |
IsEventFrom.eventFrom(Class<? extends EventObject> eventClass,
Object source)
Creates a matcher of
EventObject that matches any object
derived from eventClass announced by source. |
static Matcher<EventObject> |
IsEventFrom.eventFrom(Object source)
Creates a matcher of
EventObject that matches any EventObject
announced by source. |
static <T> Matcher<T> |
HasToString.hasToString(Matcher<? super String> toStringMatcher)
Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher. |
static <T> Matcher<T> |
HasToString.hasToString(String expectedToString)
Creates a matcher that matches any examined object whose
toString method
returns a value equalTo the specified string. |
static <T> Matcher<Class<?>> |
IsCompatibleType.typeCompatibleWith(Class<T> baseType)
Creates a matcher of
Class that matches when the specified baseType is
assignable from the examined class. |
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
HasToString.hasToString(Matcher<? super String> toStringMatcher)
Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher. |
Constructor and Description |
---|
HasToString(Matcher<? super String> toStringMatcher) |
Modifier and Type | Class and Description |
---|---|
class |
CharSequenceLength |
class |
IsBlankString
Matches blank Strings (and null).
|
class |
IsEmptyString
Matches empty Strings (and null).
|
class |
IsEqualCompressingWhiteSpace
Tests if a string is equal to another string, compressing any changes in whitespace.
|
class |
IsEqualIgnoringCase
Tests if a string is equal to another string, regardless of the case.
|
class |
MatchesPattern |
class |
StringContainsInOrder |
Modifier and Type | Method and Description |
---|---|
static Matcher<String> |
IsBlankString.blankOrNullString()
Creates a matcher of
String that matches when the examined string is null , or
contains zero or more whitespace characters and nothing else. |
static Matcher<String> |
IsBlankString.blankString()
Creates a matcher of
String that matches when the examined string contains
zero or more whitespace characters and nothing else. |
static Matcher<String> |
IsEmptyString.emptyOrNullString()
Creates a matcher of
String that matches when the examined string is null , or
has zero length. |
static Matcher<String> |
IsEmptyString.emptyString()
Creates a matcher of
String that matches when the examined string has zero length. |
static Matcher<String> |
IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace(String expectedString)
Creates a matcher of
String that matches when the examined string is equal to
the specified expectedString, when whitespace differences are (mostly) ignored. |
static Matcher<String> |
IsEqualIgnoringCase.equalToIgnoringCase(String expectedString)
Creates a matcher of
String that matches when the examined string is equal to
the specified expectedString, ignoring case. |
static Matcher<String> |
IsEqualCompressingWhiteSpace.equalToIgnoringWhiteSpace(String expectedString)
|
static Matcher<CharSequence> |
CharSequenceLength.hasLength(int length)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
static Matcher<CharSequence> |
CharSequenceLength.hasLength(Matcher<? super Integer> lengthMatcher)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
static Matcher<String> |
IsEmptyString.isEmptyOrNullString()
Deprecated.
use is(emptyOrNullString()) instead
|
static Matcher<String> |
IsEmptyString.isEmptyString()
Deprecated.
use is(emptyString()) instead
|
static Matcher<String> |
MatchesPattern.matchesPattern(Pattern pattern)
|
static Matcher<String> |
MatchesPattern.matchesPattern(String regex)
|
static Matcher<String> |
StringContainsInOrder.stringContainsInOrder(Iterable<String> substrings)
Creates a matcher of
String that matches when the examined string contains all of
the specified substrings, considering the order of their appearance. |
static Matcher<String> |
StringContainsInOrder.stringContainsInOrder(String... substrings)
Creates a matcher of
String that matches when the examined string contains all of
the specified substrings, considering the order of their appearance. |
Modifier and Type | Method and Description |
---|---|
static Matcher<CharSequence> |
CharSequenceLength.hasLength(Matcher<? super Integer> lengthMatcher)
Creates a matcher of
CharSequence that matches when a char sequence has the given length
For example: |
Constructor and Description |
---|
CharSequenceLength(Matcher<? super Integer> lengthMatcher) |
Modifier and Type | Class and Description |
---|---|
class |
HasXPath
Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression.
|
Modifier and Type | Method and Description |
---|---|
static Matcher<Node> |
HasXPath.hasXPath(String xPath)
Creates a matcher of
Node s that matches when the examined node contains a node
at the specified xPath , with any content. |
static Matcher<Node> |
HasXPath.hasXPath(String xPath,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath that satisfies the specified valueMatcher . |
static Matcher<Node> |
HasXPath.hasXPath(String xPath,
NamespaceContext namespaceContext)
Creates a matcher of
Node s that matches when the examined node contains a node
at the specified xPath within the specified namespace context, with any content. |
static Matcher<Node> |
HasXPath.hasXPath(String xPath,
NamespaceContext namespaceContext,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath , within the specified namespaceContext , that satisfies
the specified valueMatcher . |
Modifier and Type | Method and Description |
---|---|
static Matcher<Node> |
HasXPath.hasXPath(String xPath,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath that satisfies the specified valueMatcher . |
static Matcher<Node> |
HasXPath.hasXPath(String xPath,
NamespaceContext namespaceContext,
Matcher<String> valueMatcher)
Creates a matcher of
Node s that matches when the examined node has a value at the
specified xPath , within the specified namespaceContext , that satisfies
the specified valueMatcher . |
Constructor and Description |
---|
HasXPath(String xPathExpression,
Matcher<String> valueMatcher) |
HasXPath(String xPathExpression,
NamespaceContext namespaceContext,
Matcher<String> valueMatcher) |
Copyright © 2021. All rights reserved.