### Question:
MavenDependencyResolver implements DependencyResolver { @Override public org.jboss.forge.addon.dependencies.DependencyNode resolveDependencyHierarchy(final DependencyQuery query) { try { RepositorySystem system = container.getRepositorySystem(); Settings settings = container.getSettings(); DefaultRepositorySystemSession session = container.setupRepoSession(system, settings); session.setDependencyTraverser(new DependencyTraverser() { @Override public boolean traverseDependency(org.eclipse.aether.graph.Dependency dependency) { if (query.getScopeType() != null) return query.getScopeType().equals(dependency.getScope()); else return !"test".equals(dependency.getScope()); } @Override public DependencyTraverser deriveChildTraverser(DependencyCollectionContext context) { return this; } }); session.setDependencySelector(new ScopeDependencySelector("test")); final CoordinateBuilder coord = CoordinateBuilder.create(query.getCoordinate()); Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(coord); List<RemoteRepository> remoteRepos = MavenConvertUtils.convertToMavenRepos(query.getDependencyRepositories(), settings); remoteRepos.addAll(MavenRepositories.getRemoteRepositories(container, settings)); CollectRequest collectRequest = new CollectRequest(new org.eclipse.aether.graph.Dependency(queryArtifact, null), remoteRepos); DependencyRequest dr = new DependencyRequest(collectRequest, null); DependencyResult result = system.resolveDependencies(session, dr); DependencyNodeBuilder hierarchy = MavenConvertUtils.toDependencyNode(getResourceFactory(), null, result.getRoot()); return hierarchy; } catch (Exception e) { throw new DependencyException("Could not resolve dependencies for addon [" + query.getCoordinate() + "]", e); } } MavenDependencyResolver();  MavenDependencyResolver(ResourceFactory resourceFactory); @Override Set<Dependency> resolveDependencies(DependencyQuery query); @Override List<Coordinate> resolveVersions(DependencyQuery query); @Override Dependency resolveArtifact(DependencyQuery query); @Override org.jboss.forge.addon.dependencies.DependencyNode resolveDependencyHierarchy(final DependencyQuery query); @Override DependencyMetadata resolveDependencyMetadata(final DependencyQuery query);  }### Answer:
@Test public void testResolveDependencyHierarchy() throws Exception { DependencyNode root = resolver .resolveDependencyHierarchy(DependencyQueryBuilder .create("org.jboss.forge:resources:jar:forge-addon:2.0.0.Alpha3")); Assert.assertNotNull(root); Assert.assertEquals(5, root.getChildren().size()); Assert.assertEquals("convert", root.getChildren().get(1).getDependency().getCoordinate().getArtifactId()); Assert.assertEquals("ui-hints", root.getChildren().get(2).getDependency().getCoordinate().getArtifactId()); }