TestIdentifier (String[] args, String name) { final LauncherDiscoveryRequest discoveryRequest = JUnit5TestRunnerUtil.buildRequest(args, new String[1], ""); myForkedTestPlan = LauncherFactory.create().discover(discoveryRequest); final Set<TestIdentifier> roots = myForkedTestPlan.getRoots(); if (roots.isEmpty()) return null; List<TestIdentifier> nonEmptyRoots = roots.stream() .filter(identifier -> !myForkedTestPlan.getChildren(identifier).isEmpty()) .collect(Collectors.toList()); if (nonEmptyRoots.isEmpty()) return null; return nonEmptyRoots.size() == 1 ? nonEmptyRoots.get(0) : FAKE_ROOT; }