Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2011-12-28 18:05:19 +0000
committerStephan Herrmann2011-12-28 18:05:19 +0000
commitdffa4e9d39d4434e5918e783e0e4a60221ed1bb5 (patch)
treeef2c5bba8e9c36885a8321795ac5f68f1fca1994 /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring
parent76007d5c7284e895ee61d9c7f4a5a8acaeaff2a2 (diff)
downloadorg.eclipse.objectteams-dffa4e9d39d4434e5918e783e0e4a60221ed1bb5.tar.gz
org.eclipse.objectteams-dffa4e9d39d4434e5918e783e0e4a60221ed1bb5.tar.xz
org.eclipse.objectteams-dffa4e9d39d4434e5918e783e0e4a60221ed1bb5.zip
Test & fix for bug 367605 - [refactoring] missing update of base import
during renaming or moving a base class
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/rename/RenameTypeTests.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameTypeTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameTypeTests.java
index a1958828d..ce515af99 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameTypeTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameTypeTests.java
@@ -25,6 +25,7 @@ import junit.framework.TestSuite;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
@@ -459,5 +460,27 @@ public class RenameTypeTests extends RefactoringTest
public void _testShadowedNameRoleFile4() throws Exception {
performRenameRefactoring_failing(new String[] { "RT", "T1", "T2" }, "R1", "R2", true);
}
-
+
+ public void testRenameBaseClass1() throws Exception {
+ IPackageFragment packB = getRoot().createPackageFragment("b", true, null);
+ ICompilationUnit cuB = packB.createCompilationUnit("B.java", "package b;public class B {}", true, null);
+ ICompilationUnit cu1= getPackageP().createCompilationUnit("T1.java", "package p;import base b.B;team class T1{void foo(){}protected class Role playedBy B{}}", false, new NullProgressMonitor());
+ try {
+ IType baseType = cuB.getTypes()[0];
+
+ RenameRefactoring refactoring = createRefactoring(baseType, "B1");
+ RenameTypeProcessor renameTypeProcessor = (RenameTypeProcessor)_processor;
+ renameTypeProcessor.setUpdateReferences(true);
+ renameTypeProcessor.setUpdateTextualMatches(false);
+ RefactoringStatus result = performRefactoring(refactoring);
+ assertEquals("was supposed to pass", null, result);
+
+ // expect that base import has been updated in cu1:
+ String expectedSource1= "package p;import base b.B1;team class T1{void foo(){}protected class Role playedBy B1{}}";
+ assertEqualLines("source compare failed", expectedSource1, cu1.getSource());
+
+ } finally {
+ performDummySearch();
+ }
+ }
}

Back to the top