### Question:
MultipleValidationResults extends ValidationResult implements Iterable<ValidationResult> { public void add(MultipleValidationResults multipleResults) { addAll(multipleResults.results); }  @Override boolean hasErrors(); void add(MultipleValidationResults multipleResults); void add(ValidationResult singleResult); void addAll(Collection<ValidationResult> allResults); Iterator<ValidationResult> iterator(); ResultsIterable<SuccessfulValidationResult> goodResults(); ResultsIterable<FailedValidationResult> failures(); ResultsIterable<ExpressionRejectedByFilterResult> excluded(); @Override String toString();  }### Answer:
@Test public void testAddMultipleValidationResults() { ValidationResult originalResult1 = new SuccessfulValidationResult("dummyEl", 1); ValidationResult mergedResult1 = new SuccessfulValidationResult("dummyEl", 2); ValidationResult mergedResult2 = new FailedValidationResult(null); MultipleValidationResults resultsToMerge = new MultipleValidationResults(); resultsToMerge.add(mergedResult1); resultsToMerge.add(mergedResult2); ValidationResult originalResult2 = new SuccessfulValidationResult("dummyEl", 1); multipleValidationResults.add(originalResult1); multipleValidationResults.add(resultsToMerge); multipleValidationResults.add(originalResult2); for (ValidationResult result : multipleValidationResults) { if (result.equals(resultsToMerge)) { fail("The results of resultsToMerge should be merged in, not the multiresult object itself"); } } ValidationResult[] expected = new ValidationResult[] { originalResult1, mergedResult1, mergedResult2, originalResult2 }; int cnt = 0; for (ValidationResult result : multipleValidationResults) { assertEquals("Mismatch at index " + cnt , expected[cnt++], result); } }
@Test public void should_return_reports_in_order_of_addition() { ValidationResult[] input = new ValidationResult[]{ new SuccessfulValidationResult("dummyEl", null) , new SuccessfulValidationResult("dummyEl", 1) , new FailedValidationResult(null) , new FailedValidationResult(null) }; for (ValidationResult result : input) { multipleValidationResults.add(result); } assertThat(multipleValidationResults, contains(input)); }