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