void () { final String packageName = "pack1"; doTest(new MyPerformAction(packageName, "target"){ @Override protected void preprocessSrcDir(PsiDirectory srcDirectory) { final PsiFile empty = srcDirectory.findFile(EMPTY_TXT); assert empty != null; WriteCommandAction.runWriteCommandAction(null, empty::delete); } @Override protected void postProcessTargetDir(PsiDirectory targetDirectory) { final PsiDirectory subdirectory = targetDirectory.findSubdirectory(packageName); assert subdirectory != null; ApplicationManager.getApplication().runWriteAction(() -> { subdirectory.createFile(EMPTY_TXT); }); } }); }