### Question:
CompilerClassloaderUtils { public static Set<String> filterPathClasses(Collection<String> paths, String mavenRepoPath) { return paths.stream().collect(new FilterPathClassesCollector(mavenRepoPath)); } private  CompilerClassloaderUtils(); static Optional<ClassLoader> getClassloaderFromAllDependencies(String prjPath,
                                                                          String localRepo,
                                                                          String settingsXmlPath); static Map<String, byte[]> getMapClasses(String path,
                                                    Map<String, byte[]> store); static Predicate<File> filterClasses(); static Optional<ClassLoader> loadDependenciesClassloaderFromProject(String prjPath,
                                                                               String localRepo); static Optional<ClassLoader> loadDependenciesClassloaderFromProject(List<String> poms,
                                                                               String localRepo); static Optional<ClassLoader> getClassloaderFromProjectTargets(List<String> pomsPaths); static List<URL> buildUrlsFromArtifacts(String localRepo,
                                                   List<Artifact> artifacts); static List<URL> getDependenciesURL(List<String> poms,
                                               String localRepo); static List<URL> getTargetModulesURL(List<String> pomsPaths); static Optional<ClassLoader> createClassloaderFromStringDeps(List<String> depsProject); static List<URL> readAllDepsAsUrls(List<String> prjDeps); static List<URI> readAllDepsAsUris(List<String> prjDeps); static List<String> readItemsFromClasspathString(Set<String> depsModules); static List<String> getStringFromTargets(Path prjPath); static List<String> getStringFromTargetWithStream(Path pathIn,
                                                             String... extensions); static List<URI> processScannedFilesAsURIs(List<String> classPathFiles); static List<URL> processScannedFilesAsURLs(List<String> classPathFiles); static Set<String> filterPathClasses(Collection<String> paths,
                                                String mavenRepoPath); static List<String> filterClassesByPackage(Collection<String> items,
                                                      String packageName); static Class<?> getClass(String pkgName,
                                    String className,
                                    ClassLoader classloader);  }### Answer:
@Test public void filterPathClasses() { List<String> targets = new ArrayList<>(7); targets.add("/target/classes/B.class"); targets.add("/target/classes/org/kie/test/A.class"); targets.add("/target/classes/io/akka/test/C.class"); targets.add("/target/classes/com/acme/test/D.class"); targets.add("/target/classes/com/acme/test/E.class"); targets.add(mavenRepoPath + "/junit/junit/4.12/junit.jar"); targets.add(mavenRepoPath + "/junit/junit/4.12/junit-4.12.jar"); Set<String> orgKie = CompilerClassloaderUtils.filterPathClasses(targets, mavenRepoPath); assertThat(orgKie).hasSize(5); }
@Test public void filterPathSubClasses() { List<String> targets = new ArrayList<>(4); targets.add("/target/classes/org/kie/test/A.class"); targets.add("/target/classes/org/kie/test/child/B.class"); targets.add("/target/classes/org/kie/test/child/son/C.class"); targets.add("/target/classes/org/kie-test/T.class"); Set<String> orgKie = CompilerClassloaderUtils.filterPathClasses(targets, mavenRepoPath); assertThat(orgKie).hasSize(4).contains("org.kie.test", "org.kie.test.child", "org.kie.test.child.son", "org.kie-test"); }