void (VirtualFile rootDir, VirtualFile rootAfter) { final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject); final Comparator<PsiDirectory> directoryComparator = Comparator.comparing(o -> o.getVirtualFile().getPresentableUrl()); final PsiPackage sourcePackage = psiFacade.findPackage(myPackageName); assertNotNull(sourcePackage); final PsiDirectory[] srcDirectories = sourcePackage.getDirectories(); assertEquals(srcDirectories.length, 2); Arrays.sort(srcDirectories, directoryComparator); final PsiPackage targetPackage = psiFacade.findPackage(myTargetPackageName); assertNotNull(targetPackage); final PsiDirectory[] targetDirectories = targetPackage.getDirectories(); Arrays.sort(targetDirectories, directoryComparator); assertTrue(targetDirectories.length > 0); preprocessSrcDir(srcDirectories[0]); new MoveDirectoryWithClassesProcessor(getProject(), new PsiDirectory[]{srcDirectories[0]}, targetDirectories[0], false, false, true, null).run(); postProcessTargetDir(targetDirectories[0]); FileDocumentManager.getInstance().saveAllDocuments(); }