@SuppressWarnings("EqualsWhichDoesntCheckParameterClass") @Test public void honoursIsEqualImplementationEvenWithNullValues() { Object alwaysEqual = new Object() { @Override public boolean equals(Object obj) { return true; } }; Object neverEqual = new Object() { @Override public boolean equals(Object obj) { return false; } }; Matcher<Object> matcher = equalTo(null); assertMatches(matcher, alwaysEqual); assertDoesNotMatch(matcher, neverEqual); }
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);  }