mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Test for extract method containing pattern variable (IDEA-229901)
GitOrigin-RevId: 34ca9d82a66a7c3c71420b94ca9cbcd2fff7be68
This commit is contained in:
committed by
intellij-monorepo-bot
parent
afe5a8c416
commit
52ba5a3e10
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user