void (final boolean existing, String exceptionMessage, final boolean createInnerClass) { try { doTest(() -> { PsiClass aClass = myFixture.findClass("Test"); PsiMethod method = aClass.findMethodsByName("foo", false)[0]; String wrapperClassName = "Wrapper"; PsiClass wrapperClass = myFixture.getJavaFacade().findClass(wrapperClassName, GlobalSearchScope.projectScope(getProject())); assertTrue(!existing || wrapperClass != null); PsiField delegateField = existing ? wrapperClass.findFieldByName("myField", false) : null; new WrapReturnValueProcessor(wrapperClassName, "", null, method, existing, createInnerClass, delegateField).run(); }); } catch (BaseRefactoringProcessor.ConflictsInTestsException e) { if (exceptionMessage != null) { assertEquals(exceptionMessage, e.getMessage()); return; } throw e; } if (exceptionMessage != null) { fail("Conflict was not found"); } }