TimeUnitExt { public static Optional<Long> toMillis(String intervalWithUnit) { return parse(intervalWithUnit).map(p -> p.getRight().toMillis(p.getLeft())); }  static Optional<Pair<Long, TimeUnit>> parse(String intervalWithUnit); static Optional<Long> toMillis(String intervalWithUnit);  }
@Test public void testToMillis() { assertThat(TimeUnitExt.toMillis("1m").get()).isEqualTo(60_000); }