@Test public void comparesObjectsUsingEqualsMethod() { final Matcher<String> matcher1 = equalTo("hi"); assertMatches(matcher1, "hi"); assertDoesNotMatch(matcher1, "bye"); assertDoesNotMatch(matcher1, null); final Matcher<Integer> matcher2 = equalTo(1); assertMatches(matcher2, 1); assertDoesNotMatch(matcher2, 2); assertDoesNotMatch(matcher2, null); }
public static <T> Matcher<T> equalTo(T operand) { return new IsEqual<>(operand); }
IsEqual extends BaseMatcher<T> { public static <T> Matcher<T> equalTo(T operand) { return new IsEqual<>(operand); } }
IsEqual extends BaseMatcher<T> { public static <T> Matcher<T> equalTo(T operand) { return new IsEqual<>(operand); } IsEqual(T equalArg); }
IsEqual extends BaseMatcher<T> { public static <T> Matcher<T> equalTo(T operand) { return new IsEqual<>(operand); } IsEqual(T equalArg); @Override boolean matches(Object actualValue); @Override void describeTo(Description description); static Matcher<T> equalTo(T operand); static Matcher<Object> equalToObject(Object operand); }
IsEqual extends BaseMatcher<T> { public static <T> Matcher<T> equalTo(T operand) { return new IsEqual<>(operand); } IsEqual(T equalArg); @Override boolean matches(Object actualValue); @Override void describeTo(Description description); static Matcher<T> equalTo(T operand); static Matcher<Object> equalToObject(Object operand);  }