### Question:
DependencyServiceImpl implements DependencyService { @Override public Set<String> loadPackageNames(final GAV gav) { final Artifact artifact = getMavenRepository().resolveArtifact(gav.toString()); if (artifact != null) { return stripPackageNamesFromJar(artifact.getFile()); } else { return new HashSet<>(); } } DependencyServiceImpl(); @Override Collection<Dependency> loadDependencies(final Collection<GAV> gavs); @Override Collection<Dependency> loadDependencies(final GAV gav); @Override Set<String> loadPackageNames(final GAV gav); @Override EnhancedDependencies loadEnhancedDependencies(final Collection<Dependency> dependencies);  }### Answer:
@Test public void testListPackages() throws Exception { Set<String> junitPackages = service.loadPackageNames( new GAV( "junit", "junit", "4.11" ) ); Set<String> hamcrestPackages = service.loadPackageNames( new GAV( "org.hamcrest", "hamcrest-core", "1.3" ) ); assertTrue( junitPackages.contains( "org.junit.rules" ) ); assertTrue( junitPackages.contains( "org.junit.matchers" ) ); assertFalse( junitPackages.contains( "org.hamcrest" ) ); assertFalse( junitPackages.contains( "org.hamcrest.core" ) ); assertTrue( hamcrestPackages.contains( "org.hamcrest" ) ); assertTrue( hamcrestPackages.contains( "org.hamcrest.core" ) ); assertFalse( hamcrestPackages.contains( "org.junit.rules" ) ); assertFalse( hamcrestPackages.contains( "org.junit.matchers" ) ); }
@Test public void testFillDependenciesWithPackageNames() throws Exception { final Set<String> packageNames = service.loadPackageNames( new GAV( "junit", "junit", "4.11" ) ); assertEquals( 2, packageNames.size() ); assertTrue( packageNames.contains( "org.junit.rules" ) ); assertTrue( packageNames.contains( "org.junit.matchers" ) ); }