@Test public void shouldNotBeEqualIfOtherIsAnInstanceOfPredicateOverADifferentClass() throws Exception { Predicate<Number> firstInstanceOfPredicate = new InstanceOfPredicate<Number>(Integer.class); Predicate<Number> secondInstanceOfPredicate = new InstanceOfPredicate<Number>(Long.class); boolean equal = firstInstanceOfPredicate.equals(secondInstanceOfPredicate); assertThat(equal, is(false)); }
@Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); }
InstanceOfPredicate implements Predicate<T> { @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } }
InstanceOfPredicate implements Predicate<T> { @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } InstanceOfPredicate(Class<?> testClass); }
InstanceOfPredicate implements Predicate<T> { @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } InstanceOfPredicate(Class<?> testClass); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode(); }
InstanceOfPredicate implements Predicate<T> { @Override public boolean equals(Object other) { return EqualsBuilder.reflectionEquals(this, other); } InstanceOfPredicate(Class<?> testClass); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode();  }