public class IsInstanceOf extends DiagnosingMatcher<Object>
Constructor and Description |
---|
IsInstanceOf(Class<?> expectedClass)
Creates a new instance of IsInstanceOf
|
Modifier and Type | Method and Description |
---|---|
static <T> Matcher<T> |
any(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 <T> Matcher<T> |
instanceOf(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(Object item,
Description mismatchDescription) |
describeMismatch, matches
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
public IsInstanceOf(Class<?> expectedClass)
expectedClass
- The predicate evaluates to true for instances of this class
or one of its subclasses.protected boolean matches(Object item, Description mismatchDescription)
matches
in class DiagnosingMatcher<Object>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public static <T> Matcher<T> instanceOf(Class<?> type)
assertThat(anObject, instanceOf(Thing.class));
Copyright © 2016. All rights reserved.