void (final PsiClass testClass, final PsiClass srcClass, Editor srcEditor) { if (testClass != null) { final TestFramework framework = TestFrameworks.detectFramework(testClass); if (framework != null) { final Project project = testClass.getProject(); final Editor editor = CodeInsightUtil.positionCursorAtLBrace(project, testClass.getContainingFile(), testClass); if (!FileModificationService.getInstance().preparePsiElementsForWrite(testClass)) return; final MissedTestsDialog dialog = new MissedTestsDialog(project, srcClass, testClass, framework); if (dialog.showAndGet()) { WriteCommandAction.runWriteCommandAction(project, () -> JavaTestGenerator.addTestMethods(editor, testClass, srcClass, framework, dialog.getSelectedMethods(), false, false)); } } else { String message = JavaBundle.message("generate.missed.tests.action.failed.to.detect.framework", testClass.getQualifiedName()); HintManager.getInstance().showErrorHint(srcEditor, message); } } }