### Question:
AgendaProgressReporter { protected String getElapsedTime(AgendaProgress agendaProgress) { String elapsedTime = "Elapsed exec time not available for agenda: " + agendaProgress.getAgendaId(); Date startDate = agendaProgress.getStartedTime(); Date endDate = agendaProgress.getCompletedTime(); if(startDate != null && endDate != null) { long startTime = startDate.getTime(); long endTime = endDate.getTime(); Long duration = endTime - startTime; elapsedTime = duration.toString(); } return elapsedTime; } AgendaProgressReporter( ObjectPersister<Agenda> agendaPersister); void logCompletedAgenda(DataObjectResponse<AgendaProgress> response); void logCompletedAgenda(AgendaProgress partialAgendaProgress); void setAgendaProgressPersister(ObjectPersister<AgendaProgress> agendaProgressPersister);  }### Answer:
@Test public void testGetElapsedTime() { String expectedDuration = Long.toString(completedTime.getTime() - startedTime.getTime()); AgendaProgress agendaProgress = makeAgendaProgress("success"); agendaProgress.setCompletedTime(completedTime); agendaProgress.setStartedTime(startedTime); String elapsedTime = agendaProgressReporter.getElapsedTime(agendaProgress); assertThat(elapsedTime).isEqualTo(expectedDuration); }
@Test public void testValidateElapsedTime() { AgendaProgress agendaProgress = makeAgendaProgress("success"); String elapsedTime = agendaProgressReporter.getElapsedTime(agendaProgress); assertThat(elapsedTime).isEqualTo("Elapsed exec time not available for agenda: " + agendaId); }