@Test public void nameShouldNotBeEmpty() { final UserResource userResource = new UserResource("", "€"); final BeanPropertyBindingResult errors = createBindingResult(userResource); testSubject.validate(userResource, errors); assertThat(errors.getFieldError("name").getCode()).isEqualTo("name.empty"); }
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currency", "currency.empty"); }
UserResourceValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currency", "currency.empty"); } }
UserResourceValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currency", "currency.empty"); }  }
UserResourceValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currency", "currency.empty"); }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
UserResourceValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "currency", "currency.empty"); }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors);  }