mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@Override quick fixes: suggest to pull method up; pull members up, extract interface/superclass (IDEA-55720 )
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// "Pull method 'foo' to 'Int'" "true"
|
||||
public class Test implements Int {
|
||||
@Override
|
||||
public void foo(){}
|
||||
}
|
||||
|
||||
interface Int {
|
||||
void foo();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Pull method 'foo' up and make it abstract" "true"
|
||||
public class Test{
|
||||
void main(){
|
||||
new Int(){
|
||||
@Override
|
||||
void foo(){
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Int {
|
||||
abstract void foo();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Pull method 'foo' to 'Int'" "true"
|
||||
public class Test implements Int {
|
||||
@Overr<caret>ide
|
||||
void foo(){}
|
||||
}
|
||||
|
||||
interface Int {}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Pull method 'foo' to 'List'" "false"
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Test implements List{
|
||||
@Overr<caret>ide
|
||||
void foo(){}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Pull method 'foo' up and make it abstract" "true"
|
||||
public class Test{
|
||||
void main(){
|
||||
new Int(){
|
||||
@Overr<caret>ide
|
||||
void foo(){
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Int {}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Extract interface" "false"
|
||||
public class Test{
|
||||
void main(){
|
||||
new Int(){
|
||||
@Overr<caret>ide
|
||||
void foo(){
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Int {}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.ArrayList;
|
||||
public abstract class Test extends ArrayList<String> implements Int {
|
||||
@Overr<caret>ide
|
||||
void foo(){}
|
||||
}
|
||||
|
||||
interface Int {}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
|
||||
public class PullOverrideMethodUpFixTest extends LightQuickFixTestCase {
|
||||
public void test1() throws Exception {
|
||||
doSingleTest("1.java");
|
||||
}
|
||||
|
||||
public void test2() throws Exception {
|
||||
doSingleTest("2.java");
|
||||
}
|
||||
|
||||
public void test3() throws Exception {
|
||||
doSingleTest("3.java");
|
||||
}
|
||||
|
||||
public void test4() throws Exception {
|
||||
doSingleTest("4.java");
|
||||
}
|
||||
|
||||
public void testRefactoringIntentionsAvailable() throws Exception {
|
||||
doTestActionAvailable(5, "Pull members up");
|
||||
doTestActionAvailable(5, "Extract interface");
|
||||
doTestActionAvailable(5, "Extract superclass");
|
||||
}
|
||||
|
||||
private void doTestActionAvailable(final int suffix, final String actionText) {
|
||||
final String testFullPath = getBasePath() + "/before" + suffix + ".java";
|
||||
configureByFile(testFullPath);
|
||||
doHighlighting();
|
||||
final IntentionAction action = findActionWithText(actionText);
|
||||
assertNotNull(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/pullUp";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user