@Test(expected = PasswordTooShortException.class) public void shouldValidateLength() { PasswordValidator decoratedValidator = new MinLengthValidatorDecorator(validator, 3); decoratedValidator.validate("eh"); }
@Override public void validate(String password) throws PasswordValidatorException { if (minPassLength > StringUtils.length(password)) { throw new PasswordTooShortException(minPassLength); } passwordValidator.validate(password); }
MinLengthValidatorDecorator implements PasswordValidator { @Override public void validate(String password) throws PasswordValidatorException { if (minPassLength > StringUtils.length(password)) { throw new PasswordTooShortException(minPassLength); } passwordValidator.validate(password); } }
MinLengthValidatorDecorator implements PasswordValidator { @Override public void validate(String password) throws PasswordValidatorException { if (minPassLength > StringUtils.length(password)) { throw new PasswordTooShortException(minPassLength); } passwordValidator.validate(password); } MinLengthValidatorDecorator(PasswordValidator passwordValidator, int minPassLength); }
MinLengthValidatorDecorator implements PasswordValidator { @Override public void validate(String password) throws PasswordValidatorException { if (minPassLength > StringUtils.length(password)) { throw new PasswordTooShortException(minPassLength); } passwordValidator.validate(password); } MinLengthValidatorDecorator(PasswordValidator passwordValidator, int minPassLength); @Override void validate(String password); @Override String getValidationError(Locale locale); @Override String getName(); }
MinLengthValidatorDecorator implements PasswordValidator { @Override public void validate(String password) throws PasswordValidatorException { if (minPassLength > StringUtils.length(password)) { throw new PasswordTooShortException(minPassLength); } passwordValidator.validate(password); } MinLengthValidatorDecorator(PasswordValidator passwordValidator, int minPassLength); @Override void validate(String password); @Override String getValidationError(Locale locale); @Override String getName();  }