|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hamcrest.BaseMatcher<T>
org.hamcrest.DiagnosingMatcher<java.lang.Object>
org.hamcrest.core.IsInstanceOf
public class IsInstanceOf
Tests whether the value is an instance of a class. Classes of basic types will be converted to the relevant "Object" classes
Constructor Summary | |
---|---|
IsInstanceOf(java.lang.Class<?> expectedClass)
Creates a new instance of IsInstanceOf |
Method Summary | ||
---|---|---|
static
|
any(java.lang.Class<T> type)
Is the value an instance of a particular type? Use this version to make generics conform, for example in the JMock clause with(any(Thing.class)) |
|
void |
describeTo(Description description)
Generates a description of the object. |
|
static
|
instanceOf(java.lang.Class<?> type)
Is the value an instance of a particular type? This version assumes no relationship between the required type and the signature of the method that sets it up, for example in assertThat(anObject, instanceOf(Thing.class)); |
|
protected boolean |
matches(java.lang.Object item,
Description mismatchDescription)
|
Methods inherited from class org.hamcrest.DiagnosingMatcher |
---|
describeMismatch, matches |
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 |
Constructor Detail |
---|
public IsInstanceOf(java.lang.Class<?> expectedClass)
expectedClass
- The predicate evaluates to true for instances of this class
or one of its subclasses.Method Detail |
---|
protected boolean matches(java.lang.Object item, Description mismatchDescription)
matches
in class DiagnosingMatcher<java.lang.Object>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public static <T> Matcher<T> instanceOf(java.lang.Class<?> type)
assertThat(anObject, instanceOf(Thing.class));
public static <T> Matcher<T> any(java.lang.Class<T> type)
with(any(Thing.class))
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |