public List<ArtifactResult> resolve(List<Dependency> dependencies) throws
            DependencyResolutionException, ArtifactResolutionException {

        if (dependencies.size() == 0) {
            return Collections.EMPTY_LIST;
        }

        CollectRequest collectRequest = new CollectRequest();
        collectRequest.setRoot(dependencies.get(0));
        for (int idx = 1; idx < dependencies.size(); idx++) {
            collectRequest.addDependency(dependencies.get(idx));
        }

        for (RemoteRepository repository : remoteRepositories) {
            collectRequest.addRepository(repository);
        }

        DependencyFilter classpathFilter = DependencyFilterUtils
                .classpathFilter(JavaScopes.COMPILE, JavaScopes.RUNTIME);

        DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);
        return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
    }
@Test
    public void resolveValid() throws Exception {
        // please pick small artifact which has small transitive dependency
        // and let's mark as Ignore if we want to run test even without internet or maven central is often not stable
        Dependency dependency = new Dependency(new DefaultArtifact("org.apache.storm:flux-core:1.0.0"), JavaScopes.COMPILE);
        List<ArtifactResult> results = sut.resolve(Lists.newArrayList(dependency));

        assertTrue(results.size() > 0);
        // it should be org.apache.storm:flux-core:jar:1.0.0 and commons-cli:commons-cli:jar:1.2
        assertContains(results, "org.apache.storm", "flux-core", "1.0.0");
        assertContains(results, "commons-cli", "commons-cli", "1.2");
    }