JobUtil { public static String timeToString(long timeMs) { SimpleDateFormat simpleDateFormat = FORMAT.get(); if (simpleDateFormat == null) { simpleDateFormat = new SimpleDateFormat("HH:mm:ss", Locale.US); FORMAT.set(simpleDateFormat); } simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); String result = simpleDateFormat.format(new Date(timeMs)); long days = timeMs / ONE_DAY; if (days == 1) { result += " (+1 day)"; } else if (days > 1) { result += " (+" + days + " days)"; } return result; } private  JobUtil(); static String timeToString(long timeMs); static boolean hasBootPermission(Context context); static boolean hasWakeLockPermission(Context context);  }
@Test public void verifyTimeToStringReturnsCorrectString() throws Exception { assertThat(JobUtil.timeToString(TimeUnit.SECONDS.toMillis(10))).isEqualTo("00:00:10"); assertThat(JobUtil.timeToString(TimeUnit.MINUTES.toMillis(10))).isEqualTo("00:10:00"); assertThat(JobUtil.timeToString(TimeUnit.MINUTES.toMillis(70))).isEqualTo("01:10:00"); assertThat(JobUtil.timeToString(TimeUnit.HOURS.toMillis(26))).isEqualTo("02:00:00 (+1 day)"); assertThat(JobUtil.timeToString(TimeUnit.DAYS.toMillis(26))).isEqualTo("00:00:00 (+26 days)"); }