@Test public void test() { assertEquals(0, validator.getMessages().size()); validator.validate(""); assertEquals(0, validator.getMessages().size()); validator.validate("Non empty"); assertEquals(0, validator.getMessages().size()); validator.validate(null); assertEquals(1, validator.getMessages().size()); List<Message> messages = validator.getMessages(); Message msg = messages.get(0); assertEquals(Status.ERROR, msg.getStatus()); }
@Override public void validate(T instance) { if (instance == null) { addMessage(Status.ERROR, "Can't be null"); } }
NotNull extends AbstractValidator<T> { @Override public void validate(T instance) { if (instance == null) { addMessage(Status.ERROR, "Can't be null"); } } }
NotNull extends AbstractValidator<T> { @Override public void validate(T instance) { if (instance == null) { addMessage(Status.ERROR, "Can't be null"); } }  }
NotNull extends AbstractValidator<T> { @Override public void validate(T instance) { if (instance == null) { addMessage(Status.ERROR, "Can't be null"); } }  @Override void validate(T instance); }
NotNull extends AbstractValidator<T> { @Override public void validate(T instance) { if (instance == null) { addMessage(Status.ERROR, "Can't be null"); } }  @Override void validate(T instance);  }