@Test public void testNot() { Validator<String> vnot = v3.not(); assertFalse(vnot.test("correct")); assertFalse(vnot.test("coriander")); assertTrue(vnot.test("righto")); }
public final Validator<T> not() { final Validator<T> mine = this; return new Validator<>() { @Override public boolean test(T argument) { return !mine.test(argument); } @Override public String invalidMessage(T argument) { return "Validation should have failed with: " + mine.invalidMessage(argument); } }; }
Validator implements Predicate<T> { public final Validator<T> not() { final Validator<T> mine = this; return new Validator<>() { @Override public boolean test(T argument) { return !mine.test(argument); } @Override public String invalidMessage(T argument) { return "Validation should have failed with: " + mine.invalidMessage(argument); } }; } }
Validator implements Predicate<T> { public final Validator<T> not() { final Validator<T> mine = this; return new Validator<>() { @Override public boolean test(T argument) { return !mine.test(argument); } @Override public String invalidMessage(T argument) { return "Validation should have failed with: " + mine.invalidMessage(argument); } }; }  }
Validator implements Predicate<T> { public final Validator<T> not() { final Validator<T> mine = this; return new Validator<>() { @Override public boolean test(T argument) { return !mine.test(argument); } @Override public String invalidMessage(T argument) { return "Validation should have failed with: " + mine.invalidMessage(argument); } }; }  final T validate(final T argument); String invalidMessage(final T argument); final Validator<T> and(final Validator<T> other); final Validator<T> or(final Validator<T> other); final Validator<T> not(); }
Validator implements Predicate<T> { public final Validator<T> not() { final Validator<T> mine = this; return new Validator<>() { @Override public boolean test(T argument) { return !mine.test(argument); } @Override public String invalidMessage(T argument) { return "Validation should have failed with: " + mine.invalidMessage(argument); } }; }  final T validate(final T argument); String invalidMessage(final T argument); final Validator<T> and(final Validator<T> other); final Validator<T> or(final Validator<T> other); final Validator<T> not();  }