RuntimeInfoERDC implements ErrorReportDataCollector { protected String formatTimeDuration(final long timeInMs) { long timeInS = timeInMs / 1000; String upTimeFormatted = String.format("%d:%02d:%02d", timeInS / 3600, (timeInS % 3600) / 60, (timeInS % 60)); return upTimeFormatted; }  @Override Map<String, String> collect(ErrorReportCollectingContext context);  }
@Test public void testFullPattern() { AssertJUnit.assertEquals("4:02:10", runtimeInfoERDC.formatTimeDuration(((4 * 60 + 2) * 60 + 10) * 1000l)); }
@Test public void testFullPatternLong() { AssertJUnit.assertEquals("144:02:10", runtimeInfoERDC.formatTimeDuration(((144 * 60 + 2) * 60 + 10) * 1000l)); }
@Test public void testMinutesPattern() { AssertJUnit.assertEquals("0:02:10", runtimeInfoERDC.formatTimeDuration((2 * 60 + 10) * 1000l)); }
@Test public void testSecondsPattern() { AssertJUnit.assertEquals("0:00:10", runtimeInfoERDC.formatTimeDuration(10 * 1000l)); }