Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-11-14 15:06:26 +0000
committerStephan Herrmann2010-11-14 15:06:26 +0000
commit14b407f79a894c2a8815f1c7a2d87b7a9108a5b9 (patch)
treee32c7eddbdedbe6828d131e29ce165e20506db31 /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring
parent7ecc7b0c40837a9f9da6a6d1ce05e5bc64ddf85f (diff)
downloadorg.eclipse.objectteams-14b407f79a894c2a8815f1c7a2d87b7a9108a5b9.tar.gz
org.eclipse.objectteams-14b407f79a894c2a8815f1c7a2d87b7a9108a5b9.tar.xz
org.eclipse.objectteams-14b407f79a894c2a8815f1c7a2d87b7a9108a5b9.zip
Test & fix for Bug 330169 - [refactoring] Extract method throws NPE if declared lifting arg is involved
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/B_testDeclaredLifting1.java4
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/T_testDeclaredLifting1.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/B_testDeclaredLifting1.java4
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/T_testDeclaredLifting1.java19
6 files changed, 64 insertions, 3 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
index 0c6e9e3a6..4a7d41139 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTestSetup.java
@@ -57,7 +57,8 @@ public class ExtractMethodTestSetup extends TestSetup
private IPackageFragment _rolefilePackage;
private IPackageFragment _rolefileParentPackage;
private IPackageFragment _focusTypePackage;
- private IPackageFragment _overloadingPackage;
+ private IPackageFragment _overloadingPackage;
+ private IPackageFragment _syntaxPackage;
public ExtractMethodTestSetup(Test test)
{
@@ -96,8 +97,9 @@ public class ExtractMethodTestSetup extends TestSetup
_rolefileParentPackage = getRoot().createPackageFragment("roleFile_in", true, null);
_nestedTeamPackage = getRoot().createPackageFragment("nestedTeam_in", true, null);
_focusTypePackage = getRoot().createPackageFragment("focusType_in", true, null);
- _overloadingPackage = getRoot().createPackageFragment("overloading_in", true, null);
-
+ _overloadingPackage = getRoot().createPackageFragment("overloading_in", true, null);
+ _syntaxPackage = getRoot().createPackageFragment("syntax_in", true, null);
+
// _selectionPackage = getRoot().createPackageFragment("selection", true, null);
}
@@ -145,5 +147,9 @@ public class ExtractMethodTestSetup extends TestSetup
public IPackageFragment getOverloadingPackage()
{
return _overloadingPackage;
+ }
+
+ public IPackageFragment getSyntaxPackage() {
+ return _syntaxPackage;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
index c0eb561ab..1f20ff4a6 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodTests.java
@@ -477,4 +477,18 @@ public class ExtractMethodTests extends AbstractSelectionTestCase
COMPARE_WITH_OUTPUT,
"overloading_out");
}
+
+ // =====================================================================================
+ // Testing special syntactic nodes
+ // =====================================================================================
+
+ // call target is a declared-lifting argument
+ public void testDeclaredLifting1() throws Exception
+ {
+ performTest(
+ _testSetup.getSyntaxPackage(),
+ new String[] {"T", "B"},
+ COMPARE_WITH_OUTPUT,
+ "syntax_out");
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/B_testDeclaredLifting1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/B_testDeclaredLifting1.java
new file mode 100644
index 000000000..dd7170759
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/B_testDeclaredLifting1.java
@@ -0,0 +1,4 @@
+package syntax_in;
+public class B_testDeclaredLifting1 {
+
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/T_testDeclaredLifting1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/T_testDeclaredLifting1.java
new file mode 100644
index 000000000..fd9316e0d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_in/T_testDeclaredLifting1.java
@@ -0,0 +1,14 @@
+package syntax_in;
+
+public team class T_testDeclaredLifting1
+{
+ public class R playedBy B_testDeclaredLifting1
+ {
+ public void bar(){}
+ }
+
+ public void foo(final B_testDeclaredLifting1 as R o)
+ {
+ /*[*/o.bar();/*]*/
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/B_testDeclaredLifting1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/B_testDeclaredLifting1.java
new file mode 100644
index 000000000..23c5ba160
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/B_testDeclaredLifting1.java
@@ -0,0 +1,4 @@
+package syntax_out;
+public class B_testDeclaredLifting1 {
+
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/T_testDeclaredLifting1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/T_testDeclaredLifting1.java
new file mode 100644
index 000000000..7783b5d3f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ExtractMethod/syntax_out/T_testDeclaredLifting1.java
@@ -0,0 +1,19 @@
+package syntax_out;
+
+public team class T_testDeclaredLifting1
+{
+ public class R playedBy B_testDeclaredLifting1
+ {
+ public void bar(){}
+ }
+
+ public void foo(final B_testDeclaredLifting1 as R o)
+ {
+ extracted(o);
+ }
+
+ protected void extracted(final R o)
+ {
+ /*[*/o.bar();/*]*/
+ }
+} \ No newline at end of file

Back to the top