AllScenariosPageCollection extends PageCollection implements Visitable { public String getTotalDurationString() { ZonedDateTime earliestStartDateTime = getEarliestStartDateTime(); ZonedDateTime latestEndDateTime = getLatestEndDateTime(); if (earliestStartDateTime == null || latestEndDateTime == null) { return RenderingUtils.convertNanosecondsToTimeString(getTotalDuration()); } return RenderingUtils.convertNanosecondsToTimeString( ChronoUnit.NANOS.between(earliestStartDateTime, latestEndDateTime) ); } AllScenariosPageCollection(final String pageTitle); List<Report> getReports(); void clearReports(); void addReports(final Report[] reportList); int getTotalNumberOfScenarios(); boolean hasFailedScenarios(); boolean hasPassedScenarios(); boolean hasSkippedScenarios(); int getTotalNumberOfPassedScenarios(); int getTotalNumberOfFailedScenarios(); int getTotalNumberOfSkippedScenarios(); String getTotalDurationString(); String returnStartDateTimeString(); String returnEndDateTimeString(); List<CustomParameter> getCustomParameters(); void setCustomParameters(final List<CustomParameter> customParameters); boolean hasCustomParameters(); Tag getTagFilter(); void setTagFilter(final Tag tagFilter); Feature getFeatureFilter(); void setFeatureFilter(final Feature featureFilter); Step getStepFilter(); void setStepFilter(final Step stepFilter); @Override Object clone(); @Override void accept(final PageVisitor visitor);  }
@Test public void getTotalDurationStringTest() { Report report = mock(Report.class); when(report.getTotalDuration()).thenReturn(5000000000L); Report[] reports = new Report[]{report}; allScenariosPageCollection.addReports(reports); assertThat(allScenariosPageCollection.getTotalDurationString(), is("0m 05s 000ms")); }