DiscoverySelector (String line, String[] packageNameRef) { if (line.startsWith("\u001B")) { String uniqueId = line.substring("\u001B".length()); return DiscoverySelectors.selectUniqueId(uniqueId); } else if (line.startsWith("\u002B")) { String directory = line.substring("\u002B".length()); List<ClasspathRootSelector> selectors = DiscoverySelectors.selectClasspathRoots(Collections.singleton(Paths.get(directory))); if (selectors.isEmpty()) { return null; } else { return selectors.iterator().next(); } } else if (line.contains(",")) { MethodSelector selector = DiscoverySelectors.selectMethod(line.replaceFirst(",", "#")); if (packageNameRef != null) { packageNameRef[0] = selector.getClassName(); } return selector; } else { if (packageNameRef != null) { packageNameRef[0] = line; } return createClassSelector(line); } }