private List<PluginForkedTestInstance> createSharedCasesWithDependencies(PluginForkedTestContext context) {
        DependencyResolver resolver = getDependencyResolver(this.repositories);
        List<Path> sharedLibs = new ArrayList<>();
        sharedLibs.add(context.getTestClassLocationPath());
        sharedLibs.addAll(FileUtils.toPaths(context.getSharedLibraries()));
        if (sharedDependencies != null) {
            Map<String, List<Artifact>> dependencyMap = resolver.resolveDependencySets(sharedDependencies);
            for (Map.Entry<String, List<Artifact>> artifactEntry : dependencyMap.entrySet()) {
                final String testId = artifactEntry.getKey();
                final List<Artifact> artifacts = artifactEntry.getValue();
                try {
                    sharedLibs.addAll(resolveArtifactsAndDependencies(resolver, artifacts));
                } catch (DependencyResolutionException ex) {
                    logger.warn(ex, "resolveArtifactsAndDependencies failed testId={}", testId);
                }
            }
        }
        final String sharedClassName = sharedClass == null ? null : sharedClass.getName();
        SharedProcessManager sharedProcessManager = new SharedProcessManager(context, sharedClassName, sharedLibs);

        Map<String, List<Artifact>> dependencyMap = resolver.resolveDependencySets(DEPENDENCY_VERSION_FILTER, dependencies);
        if (logger.isDebugEnabled()) {
            for (Map.Entry<String, List<Artifact>> entry : dependencyMap.entrySet()) {
                logger.debug("{} {}", entry.getKey(), entry.getValue());
            }
        }
        List<PluginForkedTestInstance> cases = new ArrayList<>();
        for (Map.Entry<String, List<Artifact>> artifactEntry : dependencyMap.entrySet()) {
            final String testId = artifactEntry.getKey();
            final List<Artifact> artifacts = artifactEntry.getValue();

            List<Path> libs = null;
            try {
                libs = resolveArtifactsAndDependencies(resolver, artifacts);
            } catch (DependencyResolutionException e) {
                // TODO Skip when running the test
                logger.warn(e, "resolveArtifactsAndDependencies failed testId={}", testId);
                continue;
            }

            PluginForkedTestInstance testInstance = newSharedProcessPluginTestCase(context, testId, libs, sharedProcessManager);
            cases.add(testInstance);
            sharedProcessManager.registerTest(testInstance.getTestId(), artifacts);
        }

        return cases;
    }
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/DefaultPluginForkedTestSuite.java