@Test(expected = ValidatorException.class) public void validate_unEqualPasswordsAreNotAccepted() { UIComponent uiComponent = new UIInput(); uiComponent.getAttributes().put("pwConfirm", "Password"); confirmPwValidator.validate(null, uiComponent, "WrongConfirmedPassword"); }
@Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String password = (String) value; String confirm = (String) component.getAttributes().get("pwConfirm"); if (password == null || confirm == null || password.length() == 0 || confirm.length() == 0) { return; } if (!password.equals(confirm)) { throw new ValidatorException(new FacesMessage("Passwords are not equal.")); } }
ConfirmPasswordValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String password = (String) value; String confirm = (String) component.getAttributes().get("pwConfirm"); if (password == null || confirm == null || password.length() == 0 || confirm.length() == 0) { return; } if (!password.equals(confirm)) { throw new ValidatorException(new FacesMessage("Passwords are not equal.")); } } }
ConfirmPasswordValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String password = (String) value; String confirm = (String) component.getAttributes().get("pwConfirm"); if (password == null || confirm == null || password.length() == 0 || confirm.length() == 0) { return; } if (!password.equals(confirm)) { throw new ValidatorException(new FacesMessage("Passwords are not equal.")); } }  }
ConfirmPasswordValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String password = (String) value; String confirm = (String) component.getAttributes().get("pwConfirm"); if (password == null || confirm == null || password.length() == 0 || confirm.length() == 0) { return; } if (!password.equals(confirm)) { throw new ValidatorException(new FacesMessage("Passwords are not equal.")); } }  @Override void validate(FacesContext context, UIComponent component, Object value); }
ConfirmPasswordValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String password = (String) value; String confirm = (String) component.getAttributes().get("pwConfirm"); if (password == null || confirm == null || password.length() == 0 || confirm.length() == 0) { return; } if (!password.equals(confirm)) { throw new ValidatorException(new FacesMessage("Passwords are not equal.")); } }  @Override void validate(FacesContext context, UIComponent component, Object value);  }