DatetimeHelper { public static String convertSecondsToDuration(long totalMilliseconds) { if (totalMilliseconds < 0) { return "00:00"; } if (totalMilliseconds < 3_600_000) { return DurationFormatUtils.formatDuration(totalMilliseconds, "mm:ss", true); } else { return DurationFormatUtils.formatDuration(totalMilliseconds, "H:mm:ss", true); } }  static long getTimestamp(); static String dateToString(Date date); static Date stringToDate(String dateText); static String dateToShortReadableString(Context context, Date date); static String convertSecondsToReadableDuration(long totalMilliseconds); static String convertSecondsToDuration(long totalMilliseconds); static String formatRFC822Date(Date date);  }
@Test public void convertSecondsToDurationTest() { assertEquals("00:00", DatetimeHelper.convertSecondsToDuration(-1_000)); assertEquals("00:01", DatetimeHelper.convertSecondsToDuration(1_000)); assertEquals("05:00", DatetimeHelper.convertSecondsToDuration(300_000)); assertEquals("1:00:00", DatetimeHelper.convertSecondsToDuration(3_600_000)); assertEquals("1:00:20", DatetimeHelper.convertSecondsToDuration(3_620_000)); }