private List<PluginTestInstance> createCasesWithDependencies(PluginTestContext context) throws ClassNotFoundException {
        final PluginTestInstanceFactory pluginTestInstanceFactory = new PluginTestInstanceFactory(context);
        final List<PluginTestInstance> pluginTestInstanceList = new ArrayList<>();
        final DependencyResolver resolver = getDependencyResolver(repositories);

        final String pluginsTest = "com.navercorp.pinpoint:pinpoint-plugins-test:" + VersionUtils.VERSION;
        final Map<String, List<Artifact>> agentDependency = resolver.resolveDependencySets(pluginsTest);
        final List<Path> agentLibs = new ArrayList<>(16);
        agentLibs.addAll(FileUtils.toPaths(context.getAgentLibList()));

        for (Map.Entry<String, List<Artifact>> dependencyCase : agentDependency.entrySet()) {
            try {
                final List<Artifact> artifactList = dependencyCase.getValue();
                agentLibs.addAll(resolveArtifactsAndDependencies(resolver, artifactList));
            } catch (DependencyResolutionException e) {
                logger.info(e, "Failed to resolve artifacts and dependencies. dependency={}", dependencyCase);
                return pluginTestInstanceList;
            }
        }

        final Map<String, List<Artifact>> dependencyCases = resolver.resolveDependencySets(DEPENDENCY_VERSION_FILTER, dependencies);
        for (Map.Entry<String, List<Artifact>> dependencyCase : dependencyCases.entrySet()) {
            final String testId = dependencyCase.getKey();
            final List<Path> libs = new ArrayList<>();
            try {
                final List<Artifact> artifactList = dependencyCase.getValue();
                libs.addAll(resolveArtifactsAndDependencies(resolver, artifactList));
            } catch (DependencyResolutionException e) {
                logger.info(e, "Failed to resolve artifacts and dependencies. dependency={}", dependencyCase);
                continue;
            }

            final URL[] agentUrls = URLUtils.pathToUrls(agentLibs);

            final Thread thread = Thread.currentThread();
            final ClassLoader currentClassLoader = thread.getContextClassLoader();
            final PluginAgentTestClassLoader agentClassLoader = new PluginAgentTestClassLoader(agentUrls, currentClassLoader);
            agentClassLoader.setTransformIncludeList(context.getTransformIncludeList());
            try {
                thread.setContextClassLoader(agentClassLoader);
                final PluginTestInstance pluginTestInstance = pluginTestInstanceFactory.create(currentClassLoader, testId, agentClassLoader,
                        libs, context.getTransformIncludeList(), classLoding);
                pluginTestInstanceList.add(pluginTestInstance);
            } finally {
                thread.setContextClassLoader(currentClassLoader);
            }
        }

        return pluginTestInstanceList;
    }
We have referred OrderedThreadPoolExecutor ParentRunner of JUnit.

@author Jongho Moon
@author Taejin Koo
agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/DefaultPluginTestSuite.java