use of com.intellij.refactoring.move.moveInstanceMethod.MoveInstanceMethodProcessor in project intellij-community by JetBrains.
the class MoveInstanceMethodTest method doTest.
private void doTest(boolean isTargetParameter, final int targetIndex, final String newVisibility) throws Exception {
final String filePath = "/refactoring/moveInstanceMethod/" + getTestName(false) + ".java";
configureByFile(filePath);
final PsiElement targetElement = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assertTrue("<caret> is not on method name", targetElement instanceof PsiMethod);
PsiMethod method = (PsiMethod) targetElement;
final PsiVariable targetVariable = isTargetParameter ? method.getParameterList().getParameters()[targetIndex] : method.getContainingClass().getFields()[targetIndex];
new MoveInstanceMethodProcessor(getProject(), method, targetVariable, newVisibility, MoveInstanceMethodHandler.suggestParameterNames(method, targetVariable)).run();
checkResultByFile(filePath + ".after");
}
Aggregations