@Test @SuppressWarnings("unchecked") public void shouldReturnTrueIfTheSuppliedPredicateReturnsFalse() { Predicate<String> delegatePredicate = (Predicate<String>) mock(Predicate.class); when(delegatePredicate.evaluate(any(String.class))).thenReturn(false); NotPredicate<String> notPredicate = new NotPredicate<String>(delegatePredicate); Boolean result = notPredicate.evaluate("some string"); assertThat(result, is(true)); }
@Override public boolean evaluate(T instance) { return !predicate.evaluate(instance); }
NotPredicate implements Predicate<T> { @Override public boolean evaluate(T instance) { return !predicate.evaluate(instance); } }
NotPredicate implements Predicate<T> { @Override public boolean evaluate(T instance) { return !predicate.evaluate(instance); } NotPredicate(UnaryPredicate<? super T> predicate); }
NotPredicate implements Predicate<T> { @Override public boolean evaluate(T instance) { return !predicate.evaluate(instance); } NotPredicate(UnaryPredicate<? super T> predicate); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode(); }
NotPredicate implements Predicate<T> { @Override public boolean evaluate(T instance) { return !predicate.evaluate(instance); } NotPredicate(UnaryPredicate<? super T> predicate); @Override boolean evaluate(T instance); @Override boolean equals(Object other); @Override int hashCode();  }