void (boolean copyJavadoc, @Nullable Boolean toImplement) { String name = getTestName(false); configureByFile(BASE_DIR + "before" + name + ".java"); int offset = getEditor().getCaretModel().getOffset(); PsiElement context = getFile().findElementAt(offset); PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class); assert psiClass != null; ApplicationManager.getApplication().runWriteAction(() -> { if (toImplement == null) { PsiClassType[] implement = psiClass.getImplementsListTypes(); final PsiClass superClass = implement.length == 0 ? psiClass.getSuperClass() : implement[0].resolve(); assert superClass != null; PsiMethod method = superClass.getMethods()[0]; final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, psiClass, PsiSubstitutor.EMPTY); final List<PsiMethodMember> candidates = Collections.singletonList(new PsiMethodMember(method, OverrideImplementExploreUtil .correctSubstitutor(method, substitutor))); OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(getEditor(), psiClass, candidates, copyJavadoc, true); } else { OverrideImplementUtil.chooseAndOverrideOrImplementMethods(getProject(), getEditor(), psiClass, toImplement); } }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); checkResultByFile(BASE_DIR + "after" + name + ".java"); }