| Package | Description |
|---|---|
| org.hamcrest.core |
Fundamental matchers of objects and values, and composite matchers.
|
| 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> |
AllOf.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> |
AllOf.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> |
AllOf.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> |
AllOf.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> |
AllOf.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> |
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 <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.
|
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 <T> AnyOf<T> |
AnyOf.anyOf(Matcher<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> |
AnyOf.anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
AnyOf.anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
AnyOf.anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
static <T> AnyOf<T> |
AnyOf.anyOf(Matcher<T> first,
Matcher<? super T> second,
Matcher<? super T> third,
Matcher<? super T> fourth,
Matcher<? super T> fifth,
Matcher<? super T> sixth)
Creates a matcher that matches if the examined object matches ANY of the specified matchers.
|
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 <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 Matcher<String> |
StringContains.containsString(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 <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 Matcher<String> |
StringEndsWith.endsWith(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 <U> Matcher<Iterable<U>> |
Every.everyItem(Matcher<U> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsCollectionContaining.hasItem(Matcher<? super T> itemMatcher)
|
static <T> Matcher<Iterable<? super T>> |
IsCollectionContaining.hasItem(T item)
|
static <T> Matcher<Iterable<T>> |
IsCollectionContaining.hasItems(Matcher<? super T>... itemMatchers)
|
static <T> Matcher<Iterable<T>> |
IsCollectionContaining.hasItems(T... items)
|
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(Class<T> type)
Deprecated.
use isA(Class
|
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<T> type)
A shortcut to the frequently used
is(instanceOf(SomeClass.class)). |
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 <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.
|
Copyright © 2002–2020 JUnit. All rights reserved.