Matcher<java.lang.Class<?>>
, SelfDescribing
public class IsCompatibleType<T> extends TypeSafeMatcher<java.lang.Class<?>>
Constructor | Description |
---|---|
IsCompatibleType(java.lang.Class<T> type) |
Modifier and Type | Method | Description |
---|---|---|
void |
describeMismatchSafely(java.lang.Class<?> cls,
Description mismatchDescription) |
Subclasses should override this.
|
void |
describeTo(Description description) |
Generates a description of the object.
|
boolean |
matchesSafely(java.lang.Class<?> cls) |
Subclasses should implement this.
|
static <T> Matcher<java.lang.Class<?>> |
typeCompatibleWith(java.lang.Class<T> baseType) |
Creates a matcher of
Class that matches when the specified baseType is
assignable from the examined class. |
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
describeMismatch, matches
public IsCompatibleType(java.lang.Class<T> type)
public boolean matchesSafely(java.lang.Class<?> cls)
TypeSafeMatcher
matchesSafely
in class TypeSafeMatcher<java.lang.Class<?>>
public void describeMismatchSafely(java.lang.Class<?> cls, Description mismatchDescription)
TypeSafeMatcher
describeMismatchSafely
in class TypeSafeMatcher<java.lang.Class<?>>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public static <T> Matcher<java.lang.Class<?>> typeCompatibleWith(java.lang.Class<T> baseType)
Class
that matches when the specified baseType is
assignable from the examined class.
For example:
assertThat(Integer.class, typeCompatibleWith(Number.class))
baseType
- the base class to examine classes against