mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move method: new escalate visibility should be processed (IDEADEV-39711)
This commit is contained in:
+10
-1
@@ -8,6 +8,7 @@ import com.intellij.refactoring.move.moveInstanceMethod.MoveInstanceMethodHandle
|
||||
import com.intellij.refactoring.move.moveInstanceMethod.MoveInstanceMethodProcessor;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
@@ -44,7 +45,15 @@ public class MoveInstanceMethodTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testIDEADEV11257() throws Exception { doTest(true, 0); }
|
||||
|
||||
public void testEscalateVisibility() throws Exception {
|
||||
doTest(true, 0, VisibilityUtil.ESCALATE_VISIBILITY);
|
||||
}
|
||||
|
||||
private void doTest(boolean isTargetParameter, final int targetIndex) throws Exception {
|
||||
doTest(isTargetParameter, targetIndex, null);
|
||||
}
|
||||
|
||||
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 = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
|
||||
@@ -53,7 +62,7 @@ public class MoveInstanceMethodTest extends LightCodeInsightTestCase {
|
||||
final PsiVariable targetVariable = isTargetParameter ? method.getParameterList().getParameters()[targetIndex] :
|
||||
method.getContainingClass().getFields()[targetIndex];
|
||||
new MoveInstanceMethodProcessor(getProject(),
|
||||
method, targetVariable, null, MoveInstanceMethodHandler.suggestParameterNames (method, targetVariable)).run();
|
||||
method, targetVariable, newVisibility, MoveInstanceMethodHandler.suggestParameterNames (method, targetVariable)).run();
|
||||
checkResultByFile(filePath + ".after");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user