void (String file, String ext) { final PsiReference psiReference = myTestFixture.getReferenceAtCaretPositionWithAssertion(file + "." + ext); assertNull("Reference", psiReference.resolve()); assertTrue(psiReference.getClass().getName() + " is not a QuickFixProvider", psiReference instanceof LocalQuickFixProvider); final LocalQuickFix[] fixes = ((LocalQuickFixProvider)psiReference).getQuickFixes(); assertTrue("One action expected", fixes != null && fixes.length == 1); final Project project = myTestFixture.getProject(); final ProblemDescriptor problemDescriptor = InspectionManager.getInstance(project).createProblemDescriptor(psiReference.getElement(), "Foo", fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true); WriteCommandAction.writeCommandAction(project, myTestFixture.getFile()).run(() -> fixes[0].applyFix(project, problemDescriptor)); myTestFixture.checkResultByFile(file + "_after." + ext); }