DefaultManifestReader implements ManifestReader { List<Dependency> getDependenciesList(Manifest manifest, ManifestField field) throws ManifestException { Optional<String> value = Optional.ofNullable(getField(manifest, field)); if (!value.isPresent()) { return Collections.emptyList(); } List<String> rawDependencies = Arrays.asList(value.get().split(DEPENDENCY_DELIMITER)); List<Dependency> dependenciesList = new ArrayList<>(); for (String rawDependency : rawDependencies) { dependenciesList.add(getDependency(rawDependency.trim())); } return dependenciesList; }  @Override PluginMetadata read(Path pluginFile); static final String DEPENDENCY_DELIMITER; static final String VERSION_DELIMITER; static final DateTimeFormatter DATE_FORMATTER; }
@Test public void testGetDependenciesList() throws ManifestException { Manifest manifest = JarHelper.createManifest(manifestContents); List<Dependency> list = getDependenciesList(manifest, ManifestField.DEPENDS); assertThat(list, hasSize(2)); assertThat(list, contains( new DependencyContainer("some-plugin"), new DependencyContainer("another-plugin", "[0.9,)") )); }
@Test public void testGetEmptyDependenciesList() throws ManifestException { assertThat(getDependenciesList(new Manifest(), ManifestField.DEPENDS), empty()); }