use of com.intellij.refactoring.wrapreturnvalue.WrapReturnValueProcessor in project intellij-community by JetBrains.
the class WrapReturnValueTest method doTest.
private void doTest(final boolean existing, String exceptionMessage, final boolean createInnerClass) {
try {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
assertNotNull("Class Test not found", aClass);
PsiMethod method = aClass.findMethodsByName("foo", false)[0];
String wrapperClassName = "Wrapper";
PsiClass wrapperClass = myJavaFacade.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");
}
}
Aggregations