### Question:
CombiningValidator implements Validator<T> { @Override public ValidationResult validate(T t) { for (Validator<T> validator : validators) { ValidationResult result = validator.validate(t); if (result.isErroneous()) { debugLog(t, validator); validationListeners.forEach(listener -> listener.onValidationError(result)); return result; } } return createValidationResult(); } CombiningValidator(List<Validator<T>> validators);  CombiningValidator(Validator<T>... validators); @Override ValidationResult validate(T t); List<Validator<T>> getValidators(); @Override String toString(); void registerValidationListener(ValidationListener validationListener); void removeValidationListener(ValidationListener validationListener);  }### Answer:
@Test public void validate_containsNoValidators_invalidResult() { Validator<Token> combiningValidator = new CombiningValidator<>(new ArrayList<>()); ValidationResult validationResult = combiningValidator.validate(TOKEN); assertThat(validationResult.isValid()).isFalse(); }
@Test public void validate_twoValidValidators_validResult() { Validator<Token> combiningValidator = new CombiningValidator<>( TokenTestValidator.createValid(), TokenTestValidator.createValid()); ValidationResult validationResult = combiningValidator.validate(TOKEN); assertThat(validationResult.isValid()).isTrue(); }
@Test public void validate_twoInvalidValidators_invalidResult() { Validator<Token> combiningValidator = new CombiningValidator<>( TokenTestValidator.createInvalid(), TokenTestValidator.createInvalid()); ValidationResult validationResult = combiningValidator.validate(TOKEN); assertThat(validationResult.isErroneous()).isTrue(); }
@Test public void validate_twoInvalidValidators_containsOnlyOneErrorMessages() { Validator<Token> combiningValidator = new CombiningValidator<>( TokenTestValidator.createValid(), TokenTestValidator.createInvalid(FIRST_ERROR_MESSAGE), TokenTestValidator.createInvalid(SECOND_ERROR_MESSAGE)); String error = combiningValidator.validate(TOKEN).getErrorDescription(); assertThat(error).isEqualTo(FIRST_ERROR_MESSAGE); }