Test for extract method containing pattern variable (IDEA-229901)

GitOrigin-RevId: 34ca9d82a66a7c3c71420b94ca9cbcd2fff7be68
This commit is contained in:
Tagir Valeev
2020-01-23 04:07:21 +00:00
committed by intellij-monorepo-bot
parent afe5a8c416
commit 52ba5a3e10
3 changed files with 22 additions and 0 deletions
@@ -0,0 +1,7 @@
class X {
void test(Object obj) {
if (obj instanceof String a) {
System.out.println(<selection>a.length()</selection>);
}
}
}
@@ -0,0 +1,11 @@
class X {
void test(Object obj) {
if (obj instanceof String a) {
System.out.println(newMethod(a));
}
}
private int newMethod(String a) {
return a.length();
}
}
@@ -940,6 +940,10 @@ public class ExtractMethodTest extends LightJavaCodeInsightTestCase {
public void testParametrizedDuplicateExpression() throws Exception {
doDuplicatesTest();
}
public void testPatternVariable() throws Exception {
doTestWithLanguageLevel(LanguageLevel.JDK_14_PREVIEW);
}
public void testSuggestChangeSignatureWithChangedParameterName() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");