DefaultManifestReader implements ManifestReader { String getRequiredField(Manifest manifest, ManifestField field) throws ManifestException { Optional<String> value = Optional.ofNullable(getField(manifest, field)); if (!value.isPresent()) { throw new ManifestException(String.format("Required field %s not found in plugin manifest", field.getFieldName())); } return value.get(); }  @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 testGetMissingRequireField() throws PluginException, ManifestException { getRequiredField(new Manifest(), ManifestField.NAME); }