### Question:
PatientSummaryImpl implements PatientSummary { @Override public List<PhenotypeComponent> phenoOccurredDuring(Date start, Date end) { List<PhenotypeComponent> patientPhenotypes = new ArrayList<>(); phenoSetTimeLines.stream() .map(timeline -> timeline.occurredDuring(start, end)) .forEach(patientPhenotypes::addAll); return patientPhenotypes; } PatientSummaryImpl(Patient patient, UnionFind<TermId> hpoTermUnionFind); @Override Patient patient(); @Override void addTest(LabTest test); @Override void addTest(List<LabTest> tests); @Override List<LabTest> tests(); @Override List<PhenoSetTimeLine> timeLines(); @Override List<PhenotypeComponent> phenoAt(Date timepoint); @Override List<PhenotypeComponent> phenoPersistedDuring(Date start, Date end); @Override List<PhenotypeComponent> phenoOccurredDuring(Date start, Date end); @Override List<PhenotypeComponent> phenoSinceBorn();  }### Answer:
@Test public void phenoOccurredDuring() throws Exception { assertEquals(1, patientSummary.phenoOccurredDuring(dateFormat.parse("2015-12-31 00:00:00"), dateFormat.parse("2016-10-20 11:59:59")).size()); assertEquals(2, patientSummary.phenoOccurredDuring(dateFormat.parse("2015-12-31 00:00:00"), dateFormat.parse("2016-10-22 11:59:59")).size()); LabTest test2 = new LabTestImpl.Builder() .effectiveStart(dateFormat.parse("2017-10-20 10:30:00")) .loincId(new LoincId("15074-7")) .outcome(new HpoTerm4TestOutcome(hypoglycemia.getId(), false)) .patient(patient) .resourceId("unknown resource id") .build(); patientSummary.addTest(test2); assertEquals(3, patientSummary.phenoOccurredDuring(dateFormat.parse("2015-12-31 00:00:00"), dateFormat.parse("2018-10-22 11:59:59")).size()); }