### Question:
NotPredicate implements Predicate<T> { @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } NotPredicate(UnaryPredicate<? super T> predicate); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void shouldBeEqualIfOtherIsANotPredicateAndPredicateSuppliedAtInitialisationIsEqual() throws Exception { Predicate<Object> first = not(alwaysTrue()); Predicate<Object> second = not(alwaysTrue()); boolean equal = first.equals(second); assertThat(equal, is(true)); }
@Test public void shouldNotBeEqualIfOtherIsANotPredicateButDelegatePredicateSuppliedAtInitialisationIsDifferent() throws Exception { Predicate<Object> first = not(alwaysFalse()); Predicate<Object> second = not(alwaysTrue()); boolean equal = first.equals(second); assertThat(equal, is(false)); }
@Test public void shouldNotBeEqualIfOtherIsNotANotPredicate() throws Exception { Predicate<Object> first = not(alwaysTrue()); Predicate<Object> second = alwaysFalse(); boolean equal = first.equals(second); assertThat(equal, is(false)); }