ThrowableRunnable<Exception> ( final String className, final String fieldName, final String innerClassName, final String baseClassName, final int[] methodIndices, 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[] methods = baseClass.getMethods(); final PsiMethod[] delegatedMethods = new PsiMethod[methodIndices.length]; for (int i = 0; i < methodIndices.length; i++) { delegatedMethods[i] = methods[methodIndices[i]]; } 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(); }; }