@Test public void validateShouldReturnTrueWhenAllRulesAreSatisfied() throws PasswordValidationException { passwordValidationRules.add(successfulRule); passwordValidator.validate(DUMMY_PASSWORD_CHANGE_DTO); then(successfulRule).should().validate(DUMMY_PASSWORD_CHANGE_DTO); }
@Override public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordValidationException { for (PasswordValidationRule passwordValidationRule : passwordValidationRules) { System.out.println(passwordValidationRule.getClass().getName()); passwordValidationRule.validate(passwordChangeDTO); } }
PasswordValidatorImpl implements PasswordValidator { @Override public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordValidationException { for (PasswordValidationRule passwordValidationRule : passwordValidationRules) { System.out.println(passwordValidationRule.getClass().getName()); passwordValidationRule.validate(passwordChangeDTO); } } }
PasswordValidatorImpl implements PasswordValidator { @Override public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordValidationException { for (PasswordValidationRule passwordValidationRule : passwordValidationRules) { System.out.println(passwordValidationRule.getClass().getName()); passwordValidationRule.validate(passwordChangeDTO); } } @Autowired  PasswordValidatorImpl(Collection<PasswordValidationRule> passwordValidationRules); }
PasswordValidatorImpl implements PasswordValidator { @Override public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordValidationException { for (PasswordValidationRule passwordValidationRule : passwordValidationRules) { System.out.println(passwordValidationRule.getClass().getName()); passwordValidationRule.validate(passwordChangeDTO); } } @Autowired  PasswordValidatorImpl(Collection<PasswordValidationRule> passwordValidationRules); @Override void validate(PasswordChangeDTO passwordChangeDTO); }
PasswordValidatorImpl implements PasswordValidator { @Override public void validate(PasswordChangeDTO passwordChangeDTO) throws PasswordValidationException { for (PasswordValidationRule passwordValidationRule : passwordValidationRules) { System.out.println(passwordValidationRule.getClass().getName()); passwordValidationRule.validate(passwordChangeDTO); } } @Autowired  PasswordValidatorImpl(Collection<PasswordValidationRule> passwordValidationRules); @Override void validate(PasswordChangeDTO passwordChangeDTO);  }