BoundedMatcher

public abstract class BoundedMatcher
extends BaseMatcher<T>

java.lang.Object
   ↳ org.hamcrest.BaseMatcher<T>
     ↳ androidx.test.espresso.matcher.BoundedMatcher<T, S extends T>


Some matcher sugar that lets you create a matcher for a given type but only process items of a specific subtype of that matcher.

Use BoundedDiagnosingMatcher for better diagnostic messages when a mismatch happens.

Summary

Public constructors

BoundedMatcher(Class<? extends S> expectedType)
BoundedMatcher(Class<?> expectedType, Class<?> interfaceType1, Class...<?> otherInterfaces)

Public methods

void describeMismatch(Object item, Description description)
final boolean matches(Object item)

Protected methods

abstract boolean matchesSafely(S item)

Inherited methods

Public constructors

BoundedMatcher

public BoundedMatcher (Class<? extends S> expectedType)

Parameters
expectedType Class

BoundedMatcher

public BoundedMatcher (Class<?> expectedType, 
                Class<?> interfaceType1, 
                Class...<?> otherInterfaces)

Parameters
expectedType Class

interfaceType1 Class

otherInterfaces Class

Public methods

describeMismatch

public void describeMismatch (Object item, 
                Description description)

Parameters
item Object

description Description

matches

public final boolean matches (Object item)

Parameters
item Object

Returns
boolean

Protected methods

matchesSafely

protected abstract boolean matchesSafely (S item)

Parameters
item S

Returns
boolean