DependencyScanner { public Artifact getDependency(String className, Scope scope) { Artifact dependency = dependencyLookup.get(className); if ((dependency == null) || (dependency.scope != scope)) return null; return dependency; } DependencyScanner(File pomFile); Collection<Artifact> getDependencies(); Collection<Artifact> getDependencies(Scope... scopes); Artifact getDependency(String className, Scope scope);  }
@Test public void testGetDependency() throws Exception { File pomFile = new File("../test-dependency/pom.xml"); assertTrue("able to access POM", pomFile.exists()); DependencyScanner scanner = new DependencyScanner(pomFile); assertEquals("compile-scope dependency", "bcelx", scanner.getDependency("com.kdgregory.bcelx.classfile.Annotation", Scope.COMPILE).artifactId); assertEquals("test-scope dependency", "junit", scanner.getDependency("org.junit.Test", Scope.TEST).artifactId); assertNull("transitive dependency", scanner.getDependency("org.apache.bcel.classfile.ClassParser", Scope.TEST)); }