Skip to content

Commit

Permalink
Merge pull request bndtools#1925 from bjhargrave/fix-test
Browse files Browse the repository at this point in the history
core: Fix tests for bnd changes
  • Loading branch information
bjhargrave authored Aug 22, 2018
2 parents 81e7d71 + 3cfdce9 commit eb31d0a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
1 change: 0 additions & 1 deletion bndtools.core/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,3 @@ eclipse.deps: \
slf4j.simple,\
${junit},\
${mockito}

Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,4 @@ public void testProvideCapability() {
.get("uses"));
}

public void testOptionalImport() {
AnalyseBundleResolutionJob job = new AnalyseBundleResolutionJob("resolve", Collections.singleton(new JarFileCapReqLoader(new File("test/example2.jar"))));

IStatus status = job.run(new NullProgressMonitor());
assertEquals(IStatus.OK, status.getCode());

Map<String, List<RequirementWrapper>> reqs = job.getRequirements();
assertEquals(2, reqs.size());

List<RequirementWrapper> imports = reqs.get("osgi.wiring.package");
assertEquals("optional", imports.get(0).requirement.getDirectives()
.get("resolution"));
}

}
Binary file removed bndtools.core/test/example2.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private void clearRepos() {

static final Pattern FILTER = Pattern.compile(Pattern.quote(PackageNamespace.PACKAGE_NAMESPACE) + "\\s*=\\s*([^)= ]*)\\s*[)]");

@SuppressWarnings("unchecked")
private void mockFindProviders(final String name, Repository repo) {
doAnswer(new Answer<Map<Requirement, Collection<Capability>>>() {

Expand Down Expand Up @@ -143,7 +144,7 @@ public Map<Requirement, Collection<Capability>> answer(InvocationOnMock invocati
}

}).when(repo)
.findProviders(any());
.findProviders((Collection<? extends Requirement>) any());
}

private void mockRepositoryPlugin(String name, RepositoryPlugin p) {
Expand Down

0 comments on commit eb31d0a

Please sign in to comment.