org.hamcrest.object
Class IsCompatibleType<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<Class<?>>
org.hamcrest.object.IsCompatibleType<T>
- All Implemented Interfaces:
- Matcher<Class<?>>, SelfDescribing
public class IsCompatibleType<T>
- extends TypeSafeMatcher<Class<?>>
IsCompatibleType
public IsCompatibleType(Class<T> type)
matchesSafely
public boolean matchesSafely(Class<?> cls)
- Specified by:
matchesSafely in class TypeSafeMatcher<Class<?>>
describeMismatchSafely
public void describeMismatchSafely(Class<?> cls,
Description mismatchDescription)
- Overrides:
describeMismatchSafely in class TypeSafeMatcher<Class<?>>
describeTo
public void describeTo(Description description)
typeCompatibleWith
public static <T> Matcher<Class<?>> typeCompatibleWith(Class<T> baseType)
- Creates a matcher of
Class that matches when the specified baseType is
assignable from the examined class.
For example:
assertThat(Integer.class, typeCompatibleWith(Number.class))
- Parameters:
baseType - the base class to examine classes against
Copyright © 2014. All rights reserved.