DateTimeUtils extends TimeUtils { public static long parseDuration(String durationStr) { if (isPeriod(durationStr)) { return Duration.parse(durationStr).toMillis(); } else { return TimeUtils.parseTimeString(durationStr); } }  static boolean isRepeatable(String dateTimeStr); static boolean isPeriod(String dateTimeStr); static boolean isNumeric(String dateTimeStr); static long parseDateTime(String dateTimeStr); static long parseDuration(String durationStr); static long parseDateAsDuration(String dateTimeStr); static String[] parseISORepeatable(String isoString); static long[] parseRepeatableDateTime(String dateTimeStr);  }
@Test public void testParseDuration() { long parsedMilliseconds = DateTimeUtils.parseDuration("1h"); assertEquals(HOUR_IN_MILLISECONDS, parsedMilliseconds); }
@Test public void testParseDurationPeriodFormat() { long parsedMilliseconds = DateTimeUtils.parseDuration("PT1H"); assertEquals(HOUR_IN_MILLISECONDS, parsedMilliseconds); }
@Test public void testParseDurationDefaultMilliseconds() { long parsedMilliseconds = DateTimeUtils.parseDuration(Long.toString(HOUR_IN_MILLISECONDS)); assertEquals(HOUR_IN_MILLISECONDS, parsedMilliseconds); }