ThrowableRunnable<Exception> ( final String className, final String fieldName, final String innerClassName, final String baseClassName, final String[] methodNames, final String[] delegatedInterfaceNames, final boolean delegateOtherMembers, final boolean generateGetter) { return () -> { PsiClass aClass = myFixture.findClass(className); assertNotNull("Class " + className + " not found", aClass); PsiClass baseClass = myFixture.findClass(baseClassName); assertNotNull("Base class " + baseClassName + " not found", baseClass); final PsiMethod[] delegatedMethods; final List<PsiMethod> methodsList = new ArrayList<>(); for (String name : methodNames) { final PsiMethod[] methodsByName = baseClass.findMethodsByName(name, false); ContainerUtil.addAll(methodsList, methodsByName); } delegatedMethods = methodsList.toArray(PsiMethod.EMPTY_ARRAY); final PsiClass[] delegatedInterfaces = new PsiClass[delegatedInterfaceNames.length]; for (int i = 0; i < delegatedInterfaceNames.length; i++) { String delegatedInterfaceName = delegatedInterfaceNames[i]; PsiClass anInterface = myFixture.findClass(delegatedInterfaceName); assertNotNull(anInterface); delegatedInterfaces[i] = anInterface; } new InheritanceToDelegationProcessor( getProject(), aClass, baseClass, fieldName, innerClassName, delegatedInterfaces, delegatedMethods, delegateOtherMembers, generateGetter).run(); //FileDocumentManager.getInstance().saveAllDocuments(); }; }