T
- The type of object being matchedMatcher<T>
, SelfDescribing
public abstract class CustomTypeSafeMatcher<T> extends TypeSafeMatcher<T>
Matcher<String> aNonEmptyString = new CustomTypeSafeMatcher<String>("a non empty string") { public boolean matchesSafely(String string) { return !string.isEmpty(); } public void describeMismatchSafely(String string, Description mismatchDescription) { mismatchDescription.appendText("was empty"); } };This is a variant of
CustomMatcher
that first type checks
the argument being matched. By the time TypeSafeMatcher.matchesSafely(T)
is
is called the argument is guaranteed to be non-null and of the correct
type.Constructor | Description |
---|---|
CustomTypeSafeMatcher(java.lang.String description) |
Modifier and Type | Method | Description |
---|---|---|
void |
describeTo(Description description) |
Generates a description of the object.
|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
describeMismatch, describeMismatchSafely, matches, matchesSafely
public CustomTypeSafeMatcher(java.lang.String description)
public final void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.