|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hamcrest.BaseMatcher<T> org.hamcrest.TypeSafeDiagnosingMatcher<T>
T
- public abstract 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. This implements the null check, checks the type and then casts. To use, implement
matchesSafely().
Constructor Summary | |
---|---|
protected |
TypeSafeDiagnosingMatcher()
The default constructor for simple sub types |
protected |
TypeSafeDiagnosingMatcher(Class<?> expectedType)
Use this constructor if the subclass that implements matchesSafely
is not the class that binds <T> to a type. |
protected |
TypeSafeDiagnosingMatcher(org.hamcrest.internal.ReflectiveTypeFinder typeFinder)
Use this constructor if the subclass that implements matchesSafely
is not the class that binds <T> to a type. |
Method Summary | |
---|---|
void |
describeMismatch(Object item,
Description mismatchDescription)
Generate a description of why the matcher has not accepted the item. |
boolean |
matches(Object item)
Evaluates the matcher for argument item. |
protected abstract boolean |
matchesSafely(T item,
Description mismatchDescription)
Subclasses should implement this. |
Methods inherited from class org.hamcrest.BaseMatcher |
---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.hamcrest.SelfDescribing |
---|
describeTo |
Constructor Detail |
---|
protected TypeSafeDiagnosingMatcher(Class<?> expectedType)
matchesSafely
is not the class that binds <T> to a type.
expectedType
- The expectedType of the actual value.protected TypeSafeDiagnosingMatcher(org.hamcrest.internal.ReflectiveTypeFinder typeFinder)
matchesSafely
is not the class that binds <T> to a type.
typeFinder
- A type finder to extract the typeprotected TypeSafeDiagnosingMatcher()
Method Detail |
---|
protected abstract boolean matchesSafely(T item, Description mismatchDescription)
public final boolean matches(Object item)
Matcher
item
- the object against which the matcher is evaluated.
true
if item matches, otherwise false
.BaseMatcher
public final void describeMismatch(Object item, Description mismatchDescription)
Matcher
matches(item)
is false, but
will not check this.
describeMismatch
in interface Matcher<T>
describeMismatch
in class BaseMatcher<T>
item
- The item that the Matcher has rejected.mismatchDescription
- The description to be built or appended to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |