### Question:
Benchmark { public static <T extends QueryMatch> ValidatorResults<T> validate(Monitor monitor, Iterable<ValidatorDocument<T>> documents, MatcherFactory<T> matcherFactory) throws IOException { ValidatorResults<T> results = new ValidatorResults<>(); for (ValidatorDocument<T> doc : documents) { Matches<T> matches = monitor.match(doc.getDocument(), matcherFactory); results.add(matches, doc.getDocument().getId(), doc.getExpectedMatches()); } return results; } private  Benchmark(); static BenchmarkResults<T> run(Monitor monitor, Iterable<InputDocument> documents,
                                                                 int batchsize, MatcherFactory<T> matcherFactory); static Iterable<DocumentBatch> batchDocuments(Iterable<InputDocument> documents, int batchsize); static BenchmarkResults<PresearcherMatch> timePresearcher(Monitor monitor, int batchsize, Iterable<InputDocument> documents); static ValidatorResults<T> validate(Monitor monitor, Iterable<ValidatorDocument<T>> documents,
                                                                      MatcherFactory<T> matcherFactory);  }### Answer:
@Test public void testValidation() throws IOException { List<ValidatorDocument<QueryMatch>> docs = ImmutableList.of( vd("doc1", "some text about the world", new QueryMatch("3", "doc1"), new QueryMatch("4", "doc1")), vd("doc2", "some text about cheese", new QueryMatch("1", "doc2"), new QueryMatch("4", "doc2")), vd("doc3", "some text about cheese", new QueryMatch("1", "doc3")) ); ValidatorResults<QueryMatch> results = Benchmark.validate(monitor, docs, SimpleMatcher.FACTORY); assertThat(results.getTimer().getCount()).isEqualTo(3); assertThat(results.getCorrectMatchCount()).isEqualTo(1); assertThat(results.getBadDocuments()).containsOnly("doc1", "doc3"); assertThat(results.getExtraMatches("doc1")).containsExactly(new QueryMatch("3", "doc1")); assertThat(results.getMissingMatches("doc1")).isEmpty(); assertThat(results.getMissingMatches("doc2")).isEmpty(); assertThat(results.getExtraMatches("doc3")).isEmpty(); assertThat(results.getMissingMatches("doc3")).containsExactly(new QueryMatch("4", "doc3")); }