Set<Module> () { return myModel.getTestClasses().stream() .map(element -> { SmartPsiElementPointer<PsiClass> pointer = element.getPointer(); return ModuleUtilCore.findModuleForFile(pointer.getVirtualFile(), pointer.getProject()); }) .filter(Objects::nonNull) .collect(Collectors.toSet()); }