### Question:
Job { public static long getDurationFromPeriod(Every every) { if (!Strings.isNullOrEmpty(every.value())) { return toDuration(PERIOD_FORMATTER.parsePeriod(every.value())); } return -1; } Job(Scheduled scheduled, Method method, Every every); static long toDuration(Period period); static long getDurationFromPeriod(Every every); Method method(); Runnable function(); void submitted(ManagedScheduledFutureTask task); ManagedScheduledFutureTask task(); Scheduled scheduled(); long period(); TimeUnit unit(); static final PeriodFormatter PERIOD_FORMATTER; }### Answer:
@Test public void testGetDurationFromPeriod() throws Exception { assertThat(Job.getDurationFromPeriod(create("1d"))).isEqualTo(24 * 3600); assertThat(Job.getDurationFromPeriod(create("0d2h"))).isEqualTo(2 * 3600); assertThat(Job.getDurationFromPeriod(create("1h30m"))).isEqualTo(3600 + 30 * 60); assertThat(Job.getDurationFromPeriod(create("1m"))).isEqualTo(60); assertThat(Job.getDurationFromPeriod(create("0s"))).isEqualTo(0); assertThat(Job.getDurationFromPeriod(create("60s"))).isEqualTo(60); }