org.hamcrest.object
Class HasToString<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeDiagnosingMatcher<T>
org.hamcrest.FeatureMatcher<T,String>
org.hamcrest.object.HasToString<T>
- All Implemented Interfaces:
- Matcher<T>, SelfDescribing
public class HasToString<T>
- extends FeatureMatcher<T,String>
Method Summary |
protected String |
featureValueOf(T actual)
Implement this to extract the interesting feature. |
static
|
hasToString(Matcher<? super String> toStringMatcher)
Evaluates whether item.toString() satisfies a given matcher. |
static
|
hasToString(String expectedToString)
This is a shortcut to the frequently used has_string(equalTo(x)). |
HasToString
public HasToString(Matcher<? super String> toStringMatcher)
featureValueOf
protected String featureValueOf(T actual)
- Description copied from class:
FeatureMatcher
- Implement this to extract the interesting feature.
- Specified by:
featureValueOf
in class FeatureMatcher<T,String>
- Parameters:
actual
- the target object
- Returns:
- the feature to be matched
hasToString
public static <T> Matcher<T> hasToString(Matcher<? super String> toStringMatcher)
- Evaluates whether item.toString() satisfies a given matcher.
hasToString
public static <T> Matcher<T> hasToString(String expectedToString)
- This is a shortcut to the frequently used has_string(equalTo(x)).
For example, assertThat(hasToString(equal_to(x)))
vs. assertThat(hasToString(x))