@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); }
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 { 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 { 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); }
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); }
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);  }