mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
Java: Extract method from similar expressions by introducing a parameter (IDEA-179924, IDEA-180107)
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
public class C {
|
||||
String f1 = <selection>"a" + "b"</selection>;
|
||||
String f2 = "c" + "b";
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class C {
|
||||
String f1 = newMethod("a");
|
||||
|
||||
@NotNull
|
||||
private String newMethod(String a) {
|
||||
return a + "b";
|
||||
}
|
||||
|
||||
String f2 = newMethod("c");
|
||||
}
|
||||
@@ -839,6 +839,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testSuggestChangeSignatureTwoFieldInitializers() throws Exception {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testSuggestChangeSignatureWithChangedParameterName() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
boolean success = performExtractMethod(true, true, getEditor(), getFile(), getProject(), false, null, false, "p");
|
||||
|
||||
Reference in New Issue
Block a user