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 is
is called the argument is guaranteed to be non-null and of the correct
type.
| Modifier and Type | Field and Description |
|---|---|
| private final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | describeTo(Description
The description to be built or appended to. description)Implements org. |
| fixedDescription | back to summary |
|---|---|
| private final String fixedDescription | |
| CustomTypeSafeMatcher | back to summary |
|---|---|
| public CustomTypeSafeMatcher(String description) | |
| describeTo | back to summary |
|---|---|
| public final void describeTo(Description description) Implements org. Doc from org. Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.
| |