void (final PerformAction performAction, final String testName) { try { String path = getTestDataPath() + getTestRoot() + testName; String pathBefore = path + "/before"; VirtualFile rootDir = createTestProjectStructure(pathBefore, false); prepareProject(rootDir); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); String pathAfter = path + "/after"; final VirtualFile rootAfter = LocalFileSystem.getInstance().findFileByPath(pathAfter.replace(File.separatorChar, '/')); performAction.performAction(rootDir, rootAfter); WriteCommandAction.runWriteCommandAction(getProject(), () -> PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting()); FileDocumentManager.getInstance().saveAllDocuments(); if (myDoCompare) { PlatformTestUtil.assertDirectoriesEqual(rootAfter, rootDir); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }