void (@NotNull Set<String> sourceClassNames, @NotNull String targetPackageName, @NotNull String message) { LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_9); doTest((rootDir, rootAfter) -> { JavaPsiFacadeEx facade = JavaPsiFacadeEx.getInstanceEx(getProject()); PsiClass[] sourceClasses = sourceClassNames.stream().map(name -> facade.findClass(name)).toArray(PsiClass[]::new); PsiPackage targetPackage = facade.findPackage(targetPackageName); try { new MoveClassesOrPackagesProcessor(myProject, sourceClasses, new MultipleRootsMoveDestination(new PackageWrapper(targetPackage)), true, false, null).run(); } catch (BaseRefactoringProcessor.ConflictsInTestsException e) { assertEquals(message, e.getMessage()); return; } fail("Unreachable statement"); }); }