@Test public void testValidateEmptyCipherWithError() { PasswordReset obj = new PasswordReset(); obj.setCipher(""); obj.setEmailAddress(""); obj.setToken(""); BindException errors = new BindException(obj, "passwordReset"); new ConfirmPasswordResetValidator().validate(obj, errors); assertTrue(errors.getAllErrors().size() == 2); }
public void validate(Object clazz, Errors e) { PasswordReset obj = (PasswordReset) clazz; if (StringUtil.isEmpty(obj.getCipher())) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "emailAddress", "error.required", new Object[]{"Email Address"}); ValidationUtils.rejectIfEmptyOrWhitespace(e, "token", "error.required", new Object[]{"Confirmation Code"}); } else { ValidationUtils.rejectIfEmptyOrWhitespace(e, "cipher", "error.required", new Object[]{"Link Cipher Code"}); } }
ConfirmPasswordResetValidator implements Validator { public void validate(Object clazz, Errors e) { PasswordReset obj = (PasswordReset) clazz; if (StringUtil.isEmpty(obj.getCipher())) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "emailAddress", "error.required", new Object[]{"Email Address"}); ValidationUtils.rejectIfEmptyOrWhitespace(e, "token", "error.required", new Object[]{"Confirmation Code"}); } else { ValidationUtils.rejectIfEmptyOrWhitespace(e, "cipher", "error.required", new Object[]{"Link Cipher Code"}); } } }
ConfirmPasswordResetValidator implements Validator { public void validate(Object clazz, Errors e) { PasswordReset obj = (PasswordReset) clazz; if (StringUtil.isEmpty(obj.getCipher())) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "emailAddress", "error.required", new Object[]{"Email Address"}); ValidationUtils.rejectIfEmptyOrWhitespace(e, "token", "error.required", new Object[]{"Confirmation Code"}); } else { ValidationUtils.rejectIfEmptyOrWhitespace(e, "cipher", "error.required", new Object[]{"Link Cipher Code"}); } }  }
ConfirmPasswordResetValidator implements Validator { public void validate(Object clazz, Errors e) { PasswordReset obj = (PasswordReset) clazz; if (StringUtil.isEmpty(obj.getCipher())) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "emailAddress", "error.required", new Object[]{"Email Address"}); ValidationUtils.rejectIfEmptyOrWhitespace(e, "token", "error.required", new Object[]{"Confirmation Code"}); } else { ValidationUtils.rejectIfEmptyOrWhitespace(e, "cipher", "error.required", new Object[]{"Link Cipher Code"}); } }  @SuppressWarnings("rawtypes") boolean supports(Class clazz); void validate(Object clazz, Errors e); }
ConfirmPasswordResetValidator implements Validator { public void validate(Object clazz, Errors e) { PasswordReset obj = (PasswordReset) clazz; if (StringUtil.isEmpty(obj.getCipher())) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "emailAddress", "error.required", new Object[]{"Email Address"}); ValidationUtils.rejectIfEmptyOrWhitespace(e, "token", "error.required", new Object[]{"Confirmation Code"}); } else { ValidationUtils.rejectIfEmptyOrWhitespace(e, "cipher", "error.required", new Object[]{"Link Cipher Code"}); } }  @SuppressWarnings("rawtypes") boolean supports(Class clazz); void validate(Object clazz, Errors e);  }