[groovy] allow to select 'this' reference for 'introduce X' refactoring
[idea/community.git] / plugins / groovy / test / org / jetbrains / plugins / groovy / refactoring / introduce / field / GrIntroduceFieldTest.groovy
index e8786a904721ffa470fc34af86928116c6bb136f..76d07f61c204d0e6d06e203d232668812e6f49a8 100644 (file)
@@ -642,6 +642,26 @@ println(<selection>a + b</selection>)
 ''', EnumSet.of(CUR_METHOD), ReplaceChoice.NO
   }
 
+  void 'test introduce field from this'() {
+    doTest '''\
+class A {
+    def bar 
+    def foo() {
+        th<caret>is.bar
+    }
+}
+''', '''\
+class A {
+    def bar
+    def f = this
+
+    def foo() {
+        f.bar
+    }
+}
+''', false, false, false, FIELD_DECLARATION
+  }
+
   private void doTest(final boolean isStatic,
                       final boolean removeLocal,
                       final boolean declareFinal,