### Question:
CombinedValidator implements Validator { @Override public ValidationResults validate(Rule rule) { ValidationResults results = new ValidationResults(); for (Validator validator : validators) { results.addAll(validator.validate(rule)); } return results; } CombinedValidator(List<Validator> validators); @Override ValidationResults validate(Rule rule);  }### Answer:
@Test void shouldReturnEmptyValidationResultsOnEmptyValidators() { CombinedValidator validator = new CombinedValidator(Collections.emptyList()); ValidationResults results = validator.validate(null); assertThat(results.getResults()).isEmpty(); }
@Test void shouldReturnMessagesFromAllValidators() { CombinedValidator validator = new CombinedValidator(Arrays.asList( r -> new ValidationResults(Arrays.asList( ValidationResult.info("info", "Info"), ValidationResult.warning("warning", "Warning") )), r -> new ValidationResults(Collections.singletonList( ValidationResult.error("error", "Error") )) )); ValidationResults results = validator.validate(null); assertThat(results.getResults()).containsExactly( ValidationResult.info("info", "Info"), ValidationResult.warning("warning", "Warning"), ValidationResult.error("error", "Error") ); }
@Test void shouldPassRuleReference() { Rule rule = new Rule(Collections.emptySet(), Collections.emptyList(), null, Collections.emptyList()); List<Rule> storedRules = new ArrayList<>(); CombinedValidator validator = new CombinedValidator(Arrays.asList( r -> { storedRules.add(r); return new ValidationResults(); }, r -> { storedRules.add(r); return new ValidationResults(); } )); validator.validate(rule); assertThat(storedRules).containsExactly(rule, rule); }