11package org .hamcrest .object ;
22
3+ import org .hamcrest .FeatureMatcher ;
34import org .hamcrest .Matcher ;
45import org .hamcrest .collection .IsIn ;
56import org .hamcrest .comparator .ComparatorMatcherBuilder ;
@@ -134,6 +135,7 @@ public static Matcher<Object> nullValue() {
134135 *
135136 * @param type dummy parameter used to infer the generic type of the returned matcher
136137 */
138+ @ SuppressWarnings ("UnusedParameters" )
137139 public static <T > Matcher <T > nullValue (Class <T > type ) {
138140 return new IsNull <>();
139141 }
@@ -264,9 +266,10 @@ public static <T extends Comparable<? super T>> Matcher<T> lessThanOrEqualTo(T v
264266 * @param toStringMatcher the matcher used to verify the toString result
265267 */
266268 public static <T > Matcher <T > hasToString (org .hamcrest .Matcher <? super String > toStringMatcher ) {
267- return org .hamcrest .object .HasToString .hasToString (toStringMatcher );
269+ return new FeatureMatcher <T , String >(toStringMatcher , "with toString()" , "toString()" ) {
270+ @ Override protected String featureValueOf (T actual ) { return String .valueOf (actual ); }
271+ };
268272 }
269-
270273 /**
271274 * Creates a matcher that matches any examined object whose <code>toString</code> method
272275 * returns a value equalTo the specified string.
@@ -276,7 +279,7 @@ public static <T> Matcher<T> hasToString(org.hamcrest.Matcher<? super String> to
276279 * @param expectedToString the expected toString result
277280 */
278281 public static <T > Matcher <T > hasToString (String expectedToString ) {
279- return org . hamcrest . object . HasToString . hasToString (expectedToString );
282+ return hasToString (equalTo ( expectedToString ) );
280283 }
281284
282285 /**
0 commit comments