public class HasToString<T> extends FeatureMatcher<T,java.lang.String>
| Constructor and Description |
|---|
HasToString(Matcher<? super java.lang.String> toStringMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
featureValueOf(T actual)
Implement this to extract the interesting feature.
|
static <T> Matcher<T> |
hasToString(Matcher<? super java.lang.String> toStringMatcher)
Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher. |
static <T> Matcher<T> |
hasToString(java.lang.String expectedToString)
Creates a matcher that matches any examined object whose
toString method
returns a value equalTo the specified string. |
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringpublic HasToString(Matcher<? super java.lang.String> toStringMatcher)
protected java.lang.String featureValueOf(T actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<T,java.lang.String>actual - the target objectpublic static <T> Matcher<T> hasToString(Matcher<? super java.lang.String> toStringMatcher)
toString method
returns a value that satisfies the specified matcher.
For example:
assertThat(true, hasToString(equalTo("TRUE")))toStringMatcher - the matcher used to verify the toString resultpublic static <T> Matcher<T> hasToString(java.lang.String expectedToString)
toString method
returns a value equalTo the specified string.
For example:
assertThat(true, hasToString("TRUE"))expectedToString - the expected toString result