| java.lang.Object |
| ↳ |
org.hamcrest.BaseMatcher<S> |
| |
↳ |
androidx.test.espresso.matcher.BoundedDiagnosingMatcher<S, T extends S> |
Class Overview
A matcher that allows for a quick creation of a matcher that applies to a given type but only
processes items of a specific subtype of that matcher. Additional interfaces can be applied. This
class is syntactic sugar for Matchers.instanceOf(Class) where the first argument is the
base class and the remaining optional arguments are interfaces.
Summary
| Public Methods |
|
final
void
|
describeMismatch(Object item, Description mismatchDescription)
This method provides a default implementation for null check as well as a super type
and interface checks provided by the constructor.
|
|
final
void
|
describeTo(Description description)
|
|
final
boolean
|
matches(Object item)
|
| Protected Methods |
|
abstract
void
|
describeMoreTo(Description description)
Subclasses should implement this.
|
|
abstract
boolean
|
matchesSafely(T item, Description mismatchDescription)
Subclasses should implement this.
|
|
[Expand]
Inherited Methods |
From class
org.hamcrest.BaseMatcher
|
final
void
|
_dont_implement_Matcher___instead_extend_BaseMatcher_()
|
|
void
|
describeMismatch(Object arg0, Description arg1)
|
|
String
|
toString()
|
|
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
final
void
|
wait()
|
|
From interface
org.hamcrest.Matcher
|
abstract
void
|
_dont_implement_Matcher___instead_extend_BaseMatcher_()
|
|
abstract
void
|
describeMismatch(Object arg0, Description arg1)
|
|
abstract
boolean
|
matches(Object arg0)
|
|
From interface
org.hamcrest.SelfDescribing
|
abstract
void
|
describeTo(Description arg0)
|
|
Public Constructors
public
BoundedDiagnosingMatcher
(Class<? extends S> expectedType)
| Parameters |
expectedType |
Class |
public
BoundedDiagnosingMatcher
(Class<? extends S> expectedType, Class<?> interfaceType1, Class...<?> otherInterfaces)
| Parameters |
expectedType |
Class |
interfaceType1 |
Class |
otherInterfaces |
Class |
Public Methods
public
final
void
describeMismatch
(Object item, Description mismatchDescription)
This method provides a default implementation for null check as well as a super type
and interface checks provided by the constructor. Failing either check provides a default
mismatch description. Passing both will call into matchesSafely(Object, Description)
which will allow the sub-class to check for a mismatch and describe what went wrong (if
anything at all).
| Parameters |
item |
Object: The item which is assumed to have mismatched and should be described. |
mismatchDescription |
Description: The description builder for the mismatch. |
public
final
void
describeTo
(Description description)
| Parameters |
description |
Description |
public
final
boolean
matches
(Object item)
Protected Methods
protected
abstract
void
describeMoreTo
(Description description)
Subclasses should implement this. The fine details of the matcher should be added to the
description. Type checking information will have already been added.
| Parameters |
description |
Description: The Description object to write to.
|
protected
abstract
boolean
matchesSafely
(T item, Description mismatchDescription)
Subclasses should implement this. The item will already have been checked for the specific
type, interfaces, and will never be null.
| Parameters |
item |
T: The pre-checked item. |
mismatchDescription |
Description: A Description to write to for mismatches. |
| Returns |
boolean |
true if the item matches the expectations for this Matcher.
|