DefaultManifestReader implements ManifestReader { Optional<ZonedDateTime> getDateField(Manifest manifest, ManifestField field) throws ManifestException { try { Optional<String> value = Optional.ofNullable(getField(manifest, field)); if (!value.isPresent()) { return Optional.empty(); } return Optional.of(ZonedDateTime.parse(value.get(), DATE_FORMATTER)); } catch (Exception e) { throw new ManifestException(String.format("Invalid date and time specification")); } }  @Override PluginMetadata read(Path pluginFile); static final String DEPENDENCY_DELIMITER; static final String VERSION_DELIMITER; static final DateTimeFormatter DATE_FORMATTER; }
@Test(expected = ManifestException.class) public void testGetDateField() throws PluginException, ManifestException { Manifest manifest = JarHelper.createManifest(new HashMap<String, String>() { { put(ManifestField.DATE.getFieldName(), "invalid-date"); } }); assertFalse(getDateField(manifest, ManifestField.NAME).isPresent()); getDateField(manifest, ManifestField.DATE); }