Java: Extract method from similar expressions by introducing a parameter (IDEA-179924, IDEA-180107)

This commit is contained in:
Pavel Dolgov
2017-10-12 16:02:04 +03:00
parent 91b7b3e720
commit 0fe0c296c4
5 changed files with 26 additions and 1 deletions
@@ -0,0 +1,4 @@
public class C {
String f1 = <selection>"a" + "b"</selection>;
String f2 = "c" + "b";
}
@@ -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");