void (@NotNull String existingClassName, final String existingClassPackage, final boolean generateAccessors, final String newVisibility, final Function<PsiMethod, ParameterInfoImpl[]> function) { doTest(() -> { PsiClass aClass = myFixture.getJavaFacade().findClass("Test", GlobalSearchScope.projectScope(getProject())); if (aClass == null) { aClass = myFixture.getJavaFacade().findClass("p2.Test", GlobalSearchScope.projectScope(getProject())); } assertNotNull("Class Test not found", aClass); final PsiMethod method = aClass.findMethodsByName("foo", false)[0]; final ParameterInfoImpl[] mergedParams = function.fun(method); final JavaIntroduceParameterObjectClassDescriptor classDescriptor = new JavaIntroduceParameterObjectClassDescriptor(existingClassName, existingClassPackage, null, true, false, newVisibility, mergedParams, method, generateAccessors); final List<ParameterInfoImpl> parameters = new JavaMethodDescriptor(method).getParameters(); IntroduceParameterObjectProcessor processor = new IntroduceParameterObjectProcessor<>( method, classDescriptor, parameters, false); processor.run(); LocalFileSystem.getInstance().refresh(false); FileDocumentManager.getInstance().saveAllDocuments(); }); }