### Question:
LayerDefinitionParser implements CommandLine.ITypeConverter<FileEntriesLayer> { @VisibleForTesting static ModificationTimeProvider parseTimestampsDirective(String directive) { if ("actual".equals(directive)) { return new ActualTimestampProvider(); } if (directive.matches("\\d+")) { long secondsSinceEpoch = Long.parseLong(directive); return new FixedTimestampProvider(Instant.ofEpochSecond(secondsSinceEpoch)); } return new FixedTimestampProvider( DateTimeFormatter.ISO_DATE_TIME.parse(directive, Instant::from)); }  @Override FileEntriesLayer convert(String layerDefinition);  }### Answer:
@Test public void testParseTimestampsDirective_actual() { MatcherAssert.assertThat( LayerDefinitionParser.parseTimestampsDirective("actual"), CoreMatchers.instanceOf(ActualTimestampProvider.class)); }
@Test public void testParseTimestampsDirective_secondsSinceEpoch() { ModificationTimeProvider provider = LayerDefinitionParser.parseTimestampsDirective("1"); MatcherAssert.assertThat(provider, CoreMatchers.instanceOf(FixedTimestampProvider.class)); Assert.assertEquals(Instant.ofEpochSecond(1), ((FixedTimestampProvider) provider).fixed); }
@Test public void testParseTimestampsDirective_is8601Date() { ModificationTimeProvider provider = LayerDefinitionParser.parseTimestampsDirective("1970-01-01T00:00:01.000Z"); MatcherAssert.assertThat(provider, CoreMatchers.instanceOf(FixedTimestampProvider.class)); Assert.assertEquals(Instant.ofEpochSecond(1), ((FixedTimestampProvider) provider).fixed); }
@Test public void testParseTimestampsDirective_invalid() { try { LayerDefinitionParser.parseTimestampsDirective("invalid"); Assert.fail(); } catch (RuntimeException ex) { MatcherAssert.assertThat(ex, CoreMatchers.instanceOf(DateTimeParseException.class)); } }