### Question:
DependencyServiceImpl implements DependencyService { @Override public Collection<Dependency> loadDependencies(final Collection<GAV> gavs) { final ArrayList<Dependency> dependencies = new ArrayList<Dependency>(); for (final GAV gav : gavs) { dependencies.addAll(loadDependencies(gav)); } return dependencies; } 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 testNoDependencies() throws Exception { GAV gav = new GAV( "artifactID", "groupID", "version" ); Collection<Dependency> dependencies = service.loadDependencies( gav ); assertTrue( dependencies.isEmpty() ); }
@Test public void testDependencies() throws Exception { Collection<Dependency> dependencies = service.loadDependencies( new GAV( "junit", "junit", "4.11" ) ); assertEquals( 1, dependencies.size() ); Dependency dependency = dependencies.iterator().next(); assertEquals( "org.hamcrest", dependency.getGroupId() ); assertEquals( "hamcrest-core", dependency.getArtifactId() ); assertEquals( "1.3", dependency.getVersion() ); }
@Test public void testDependenciesForGAVs() throws Exception { final Collection<GAV> gavs = new ArrayList<GAV>(); gavs.add( new GAV( "junit", "junit", "4.11" ) ); gavs.add( new GAV( "org.guvnor", "guvnor-web-app", "5.0" ) ); Collection<Dependency> dependencies = service.loadDependencies( gavs ); assertEquals( 2, dependencies.size() ); final Iterator<Dependency> iterator = dependencies.iterator(); Dependency dependency = iterator.next(); assertEquals( "org.hamcrest", dependency.getGroupId() ); assertEquals( "hamcrest-core", dependency.getArtifactId() ); assertEquals( "1.3", dependency.getVersion() ); dependency = iterator.next(); assertEquals( "org.drools", dependency.getGroupId() ); assertEquals( "drools-core", dependency.getArtifactId() ); assertEquals( "5.0", dependency.getVersion() ); }