void () { VirtualFile file = createChildData(mySrcDir1, "file.java"); final String DISK_CONTENT = "class A{}"; setBinaryContent(file, DISK_CONTENT.getBytes(StandardCharsets.UTF_8)); final PsiFile psiFile = myPsiManager.findFile(file); CommandProcessor.getInstance().executeCommand(myProject, () -> { try { ApplicationManager.getApplication().runWriteAction(() -> { CodeStyleManager.getInstance(myProject).reformat(psiFile); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); myPsiManager.reloadFromDisk(psiFile); }); } catch (Exception e) { LOG.error(e); } }, "", null); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); assertEquals(DISK_CONTENT, psiFile.getText()); assertEquals(file.getModificationStamp(), psiFile.getViewProvider().getModificationStamp()); }