void (@NotNull String extension) { WriteCommandAction.runWriteCommandAction(getProject(), () -> { String fileName = getTestName(false) + extension; try { PsiFile file = myFixture.configureByFile(fileName); JavaCodeStyleManager.getInstance(getProject()).optimizeImports(file); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); myFixture.checkResultByFile(getTestName(false) + "_after" + extension); PsiTestUtil.checkFileStructure(file); } catch (Exception e) { LOG.error(e); } }); }