void () { doTest((rootDir, rootAfter) -> { JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject()); PsiPackage pack1 = facade.findPackage("pack1"); assertSize(2, pack1.getDirectories()); assertSize(1, facade.findPackage("pack1.inside").getDirectories()); assertSize(1, facade.findPackage("pack1Unrelated").getDirectories()); PsiPackage[] sourcePackages = new PsiPackage[]{pack1}; PsiPackage targetPackage = facade.findPackage("target"); new MoveClassesOrPackagesProcessor(myProject, sourcePackages, new MultipleRootsMoveDestination(new PackageWrapper(targetPackage)), true, true, null).run(); FileDocumentManager.getInstance().saveAllDocuments(); assertSize(2, facade.findPackage("target.pack1").getDirectories()); assertSize(1, facade.findPackage("target.pack1.inside").getDirectories()); assertSize(1, facade.findPackage("pack1Unrelated").getDirectories()); }); }