void () { Project project = getProject(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project); CommandProcessor commandProcessor = CommandProcessor.getInstance(); PsiFile file = createFile("A.java", ""); Document document = documentManager.getDocument(file); assertNotNull(document); String initial = loadFile("/performance/bigFile.java"); ThrowableRunnable setup = () -> { Runnable command = () -> WriteAction.run(() -> document.replaceString(0, document.getTextLength(), initial)); commandProcessor.executeCommand(project, command, null, null); documentManager.commitDocument(document); }; ThrowableRunnable test = () -> { Runnable command = () -> WriteAction.run(() -> FormatterTestUtils.ACTIONS.get(FormatterTestUtils.Action.REFORMAT_WITH_CONTEXT).run(file, 6682, 6686)); commandProcessor.executeCommand(project, command, null, null); }; PlatformTestUtil .startPerformanceTest("smart reformat on big file", 500, test) .setup(setup) .assertTiming(); }