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)
|
static
|
hasToString(Matcher<? super String> toStringMatcher)
Creates a matcher that matches any examined object whose toString method
returns a value that satisfies the specified matcher. |
static
|
hasToString(String expectedToString)
Creates a matcher that matches any examined object whose toString method
returns a value equalTo the specified string. |
HasToString
public HasToString(Matcher<? super String> toStringMatcher)
featureValueOf
protected String featureValueOf(T actual)
- Specified by:
featureValueOf in class FeatureMatcher<T,String>
hasToString
public static <T> Matcher<T> hasToString(Matcher<? super String> toStringMatcher)
- Creates a matcher that matches any examined object whose
toString method
returns a value that satisfies the specified matcher.
For example:
assertThat(true, hasToString(equalTo("TRUE")))
- Parameters:
toStringMatcher - the matcher used to verify the toString result
hasToString
public static <T> Matcher<T> hasToString(String expectedToString)
- Creates a matcher that matches any examined object whose
toString method
returns a value equalTo the specified string.
For example:
assertThat(true, hasToString("TRUE"))
- Parameters:
expectedToString - the expected toString result
Copyright © 2014. All rights reserved.