EpochSecondsDelayParser implements DelayParser { @Override public Duration parse(final String value) { final Instant instant = parseDate(value); if (instant == null) { return null; } final Duration duration = between(now(clock), instant); if (duration.compareTo(threshold) > 0) { return duration; } return null; } EpochSecondsDelayParser(final Clock clock); @Override Duration parse(final String value);  }
@Test void shouldParseEpochSeconds() { assertEquals(Duration.ofSeconds(17), unit.parse("1529803194")); }
@Test void shouldIgnoreSeconds() { assertNull(unit.parse("17")); }
@Test void shouldIgnoreSecondsUpTo24HoursInThePast() { assertNull(unit.parse("1529709577")); }
@Test void shouldParseEpochSecondsOfAtLeast24Hours() { assertEquals(Duration.ofDays(1).plusHours(2).minusSeconds(1).negated(), unit.parse("1529709578")); }
@Test void shouldParseEpochSecondsFarInTheFuture() { assertEquals(Duration.ofDays(1), unit.parse("1529889577")); }
@Test void shouldIgnoreIso8601() { assertNull(unit.parse("2018-04-11T22:34:28Z")); }
@Test void shouldIgnoreEmptyString() { assertNull(unit.parse("")); }