void (@NotNull Set<String> sourceClassNames, @NotNull String targetPackageName) { LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_9); BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(() -> { doTest((rootDir, rootAfter) -> { JavaPsiFacadeEx facade = JavaPsiFacadeEx.getInstanceEx(getProject()); PsiClass[] sourceClasses = sourceClassNames.stream().map(name -> facade.findClass(name, GlobalSearchScope.allScope(myProject))) .toArray(PsiClass[]::new); PsiPackage targetPackage = facade.findPackage(targetPackageName); new MoveClassesOrPackagesProcessor(myProject, sourceClasses, new MultipleRootsMoveDestination(new PackageWrapper(targetPackage)), true, false, null).run(); FileDocumentManager.getInstance().saveAllDocuments(); }); }); }