Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-08-29 00:11:42 +0000
committerStephan Herrmann2010-08-29 00:11:42 +0000
commit7fc9b5756616abd6a2429a3aad4d52d528b13c2a (patch)
treedf2d700bbc111898869809abbeff40521588b884 /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring
parent961f768cc711d1f2caf25f5f9ea13ac5040572d8 (diff)
downloadorg.eclipse.objectteams-7fc9b5756616abd6a2429a3aad4d52d528b13c2a.tar.gz
org.eclipse.objectteams-7fc9b5756616abd6a2429a3aad4d52d528b13c2a.tar.xz
org.eclipse.objectteams-7fc9b5756616abd6a2429a3aad4d52d528b13c2a.zip
Tests and fix for Bug 311879 - [refactoring] adapt "change signature" refactoring
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/misc/ChangeSignatureTests.java314
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_in.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_out.java18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_in.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_out.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_in.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_out.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_in.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_out.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_in.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_out.java18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_in.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_out.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_in.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_out.java22
15 files changed, 498 insertions, 0 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java
new file mode 100644
index 000000000..bef867db1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/misc/ChangeSignatureTests.java
@@ -0,0 +1,314 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2010 GK Software AG
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * $Id$
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Stephan Herrmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.refactoring.misc;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.corext.refactoring.ParameterInfo;
+import org.eclipse.jdt.internal.corext.refactoring.RefactoringAvailabilityTester;
+import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+import org.eclipse.objectteams.otdt.ui.tests.refactoring.MySetup;
+import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest;
+
+/**
+ * Some helper methods in this class have been inspired by the test class
+ * <code>ChangeSignatureTests</code> in the test suite
+ * <code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse JDT.
+ *
+ * @author stephan
+ */
+@SuppressWarnings("restriction")
+public class ChangeSignatureTests extends RefactoringTest {
+
+ private static final String REFACTORING_PATH = "ChangeSignature/";
+
+ public ChangeSignatureTests(String name) {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new MySetup(new TestSuite(ChangeSignatureTests.class));
+ }
+
+ public static Test setUpTest(Test test)
+ {
+ return new MySetup(test);
+ }
+
+ protected String getRefactoringPath()
+ {
+ return REFACTORING_PATH;
+ }
+
+ private Refactoring createRefactoring(ChangeSignatureProcessor processor)
+ {
+ return new ProcessorBasedRefactoring(processor);
+ }
+
+ private ChangeSignatureProcessor createProcessor(IMethod method) throws JavaModelException
+ {
+ return new ChangeSignatureProcessor(method);
+ }
+
+
+ private String getSimpleTestFileName(boolean canReorder, boolean input){
+ String fileName = "A_" + getName();
+ if (canReorder)
+ fileName += input ? "_in": "_out";
+ return fileName + ".java";
+ }
+
+ private String getTestFileName(boolean canReorder, boolean input){
+ String fileName= getTestFolderPath(canReorder);
+ return fileName + getSimpleTestFileName(canReorder, input);
+ }
+
+ private String getTestFolderPath(boolean canModify) {
+ String fileName= TEST_PATH_PREFIX + getRefactoringPath();
+ fileName += (canModify ? "canModify/": "cannotModify/");
+ return fileName;
+ }
+
+ //---helpers
+
+ protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input) throws Exception {
+ return createCU(pack, getSimpleTestFileName(canRename, input), getFileContents(getTestFileName(canRename, input)));
+ }
+
+ static ParameterInfo[] createNewParamInfos(String[] newTypes, String[] newNames, String[] newDefaultValues) {
+ if (newTypes == null)
+ return new ParameterInfo[0];
+ ParameterInfo[] result= new ParameterInfo[newTypes.length];
+ for (int i= 0; i < newDefaultValues.length; i++) {
+ result[i]= ParameterInfo.createInfoForAddedParameter(newTypes[i], newNames[i], newDefaultValues[i]);
+ }
+ return result;
+ }
+
+ static void addInfos(List list, ParameterInfo[] newParamInfos, int[] newIndices) {
+ if (newParamInfos == null || newIndices == null)
+ return;
+ for (int i= newIndices.length - 1; i >= 0; i--) {
+ list.add(newIndices[i], newParamInfos[i]);
+ }
+ }
+
+ private void helperAdd(String[] signature, ParameterInfo[] newParamInfos, int[] newIndices, boolean createDelegate, String expectedInfo) throws Exception {
+ ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
+ IType classA= getType(cu, "A");
+ IMethod method = classA.getMethod("m", signature);
+ assertTrue("method does not exist", method.exists());
+ assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
+
+ ChangeSignatureProcessor processor= new ChangeSignatureProcessor(method);
+ Refactoring ref= new ProcessorBasedRefactoring(processor);
+
+ processor.setDelegateUpdating(createDelegate);
+ addInfos(processor.getParameterInfos(), newParamInfos, newIndices);
+ RefactoringStatus initialConditions= ref.checkInitialConditions(new NullProgressMonitor());
+ assertTrue("precondition was supposed to pass:"+initialConditions.getEntryWithHighestSeverity(), initialConditions.isOK());
+ RefactoringStatus result= performRefactoring(ref, true);
+ if (expectedInfo != null) {
+ assertTrue("precondition was supposed to create an info:"+result.getEntryWithHighestSeverity(), result.hasInfo());
+ assertEquals("wrong info", expectedInfo, result.getEntryMatchingSeverity(RefactoringStatus.INFO).getMessage());
+ } else {
+ assertEquals("precondition was supposed to pass", null, result);
+ }
+
+ IPackageFragment pack= (IPackageFragment)cu.getParent();
+ String newCuName= getSimpleTestFileName(true, true);
+ ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
+ assertTrue(newCuName + " does not exist", newcu.exists());
+ String expectedFileContents= getFileContents(getTestFileName(true, false));
+ assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
+
+// assertParticipant(classA);
+ }
+
+ private void helperDelete(String[] signature, int[] deleteIndices, boolean createDelegate, String expectedInfo) throws Exception {
+ ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
+ IType classA= getType(cu, "A");
+ IMethod method = classA.getMethod("m", signature);
+ assertTrue("method does not exist", method.exists());
+ assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
+
+ ChangeSignatureProcessor processor= new ChangeSignatureProcessor(method);
+ Refactoring ref= new ProcessorBasedRefactoring(processor);
+
+ processor.setDelegateUpdating(createDelegate);
+ markAsDeleted(processor.getParameterInfos(), deleteIndices);
+ RefactoringStatus initialConditions= ref.checkInitialConditions(new NullProgressMonitor());
+ assertTrue("precondition was supposed to pass:"+initialConditions.getEntryWithHighestSeverity(), initialConditions.isOK());
+ RefactoringStatus result= performRefactoring(ref, true);
+ if (expectedInfo != null) {
+ assertTrue("precondition was supposed to create an info:"+result.getEntryWithHighestSeverity(), result.hasInfo());
+ assertEquals("wrong info", expectedInfo, result.getEntryMatchingSeverity(RefactoringStatus.INFO).getMessage());
+ } else {
+ assertEquals("precondition was supposed to pass", null, result);
+ }
+
+ IPackageFragment pack= (IPackageFragment)cu.getParent();
+ String newCuName= getSimpleTestFileName(true, true);
+ ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
+ assertTrue(newCuName + " does not exist", newcu.exists());
+ String expectedFileContents= getFileContents(getTestFileName(true, false));
+ assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
+
+// assertParticipant(classA);
+ }
+
+ private void helperPermute(String[] newOrder, String[] signature, boolean createDelegate) throws Exception{
+ ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
+ IType classA= getType(cu, "A");
+ IMethod method = classA.getMethod("m", signature);
+ assertTrue("method does not exist", method.exists());
+ assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
+
+ ChangeSignatureProcessor processor= new ChangeSignatureProcessor(method);
+ Refactoring ref= new ProcessorBasedRefactoring(processor);
+
+ processor.setDelegateUpdating(createDelegate);
+ permute(processor.getParameterInfos(), newOrder);
+ ref.checkInitialConditions(new NullProgressMonitor());
+ RefactoringStatus result= performRefactoring(ref, true);
+ assertEquals("precondition was supposed to pass", null, result);
+
+ IPackageFragment pack= (IPackageFragment)cu.getParent();
+ String newCuName= getSimpleTestFileName(true, true);
+ ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
+ assertTrue(newCuName + " does not exist", newcu.exists());
+ String expectedFileContents= getFileContents(getTestFileName(true, false));
+// assertEquals("invalid renaming", expectedFileContents, newcu.getSource());
+ assertEqualLines(expectedFileContents, newcu.getSource());
+
+// assertParticipant(classA);
+ }
+
+ private void permute(List infos, String[] newOrder) {
+ int[] permutation= createPermutation(infos, newOrder);
+ List swapped= new ArrayList(infos.size());
+ ParameterInfo[] newInfos= new ParameterInfo[infos.size()];
+ for (int i= 0; i < permutation.length; i++) {
+ newInfos[i]= (ParameterInfo)infos.get(permutation[i]);
+ }
+ infos.clear();
+ for (int i= 0; i < newInfos.length; i++) {
+ infos.add(newInfos[i]);
+ }
+ }
+
+ private static int[] createPermutation(List infos, String[] newOrder) {
+ int[] result= new int[infos.size()];
+ for (int i= 0; i < result.length; i++) {
+ result[i]= indexOfOldName(infos, newOrder[i]);
+ }
+ return result;
+ }
+
+ private static int indexOfOldName(List infos, String string) {
+ for (Iterator iter= infos.iterator(); iter.hasNext();) {
+ ParameterInfo info= (ParameterInfo) iter.next();
+ if (info.getOldName().equals(string))
+ return infos.indexOf(info);
+ }
+ assertTrue(false);
+ return -1;
+ }
+
+ private void markAsDeleted(List list, int[] deleted) {
+ if (deleted == null)
+ return;
+ for (int i= 0; i < deleted.length; i++) {
+ ((ParameterInfo)list.get(deleted[i])).markAsDeleted();
+ }
+ }
+
+ // add argument at base side of callin
+ public void testAdd01()throws Exception{
+ String[] signature= {"I"};
+ String[] newNames= {"x"};
+ String[] newTypes= {"int"};
+ String[] newDefaultValues= {"0"};
+ ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
+ int[] newIndices= {1};
+ helperAdd(signature, newParamInfo, newIndices, true/*delegate*/, null/*expectInfo*/);
+ }
+
+ // add argument at role side (inherited from non-role) of callout
+ public void testAdd02()throws Exception{
+ String[] signature= {"I"};
+ String[] newNames= {"x"};
+ String[] newTypes= {"int"};
+ String[] newDefaultValues= {"0"};
+ ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
+ int[] newIndices= {1};
+ helperAdd(signature, newParamInfo, newIndices, false/*delegate*/, null/*expectInfo*/);
+ }
+
+ // add argument at role side of callin
+ public void testAdd03()throws Exception{
+ String[] signature= {"I"};
+ String[] newNames= {"x"};
+ String[] newTypes= {"int"};
+ String[] newDefaultValues= {"0"};
+ ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
+ int[] newIndices= {1};
+ helperAdd(signature, newParamInfo, newIndices, false/*delegate*/, "Adding arguments at the role side of a callin binding is not fully supported. Please manually update transitive references."/*expectedInfo*/);
+ }
+
+ // add argument at base side of callout
+ public void testAdd04()throws Exception{
+ String[] signature= {"I"};
+ String[] newNames= {"x"};
+ String[] newTypes= {"int"};
+ String[] newDefaultValues= {"0"};
+ ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
+ int[] newIndices= {1};
+ helperAdd(signature, newParamInfo, newIndices, false/*delegate*/, "Adding arguments at the base side of a callout binding is not fully supported. Please manually update transitive references."/*expectedInfo*/);
+ }
+
+ // delete argument at base side of callin
+ public void testDelete01()throws Exception{
+ int[] deleteIndices= {1};
+ helperDelete(new String[]{"I", "I"}, deleteIndices, true/*delegate*/, "Deleting arguments at the base side of a callin binding is not fully supported. Please manually update transitive references."/*expectInfo*/);
+ }
+
+ // delete argument at role side (inherited from non-role) of callout
+ public void testDelete02()throws Exception{
+ int[] deleteIndices= {1};
+ helperDelete(new String[]{"I", "I"}, deleteIndices, false/*delegate*/, "Deleting arguments at the role side of a callout binding is not fully supported. Please manually update transitive references."/*expectInfo*/);
+ }
+
+ public void testReorder01() throws Exception {
+ helperPermute(new String[]{"ignore", "b", "a"}, new String[]{"I", "Z", "QString;"}, false);
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_in.java
new file mode 100644
index 000000000..0b5545365
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_in.java
@@ -0,0 +1,11 @@
+package p;
+class A{
+ private void m(int i){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void m(int i) <- after void m(int i);
+ void m(int i) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_out.java
new file mode 100644
index 000000000..429e245e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd01_out.java
@@ -0,0 +1,18 @@
+package p;
+class A{
+ /**
+ * @deprecated Use {@link #m(int,int)} instead
+ */
+ private void m(int i){
+ m(i, 0);
+ }
+
+ private void m(int i, int x){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void m(int i) <- after void m(int i, int x);
+ void m(int i) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_in.java
new file mode 100644
index 000000000..19f0e2737
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_in.java
@@ -0,0 +1,12 @@
+package p;
+abstract class A{
+ abstract void m(int i);
+}
+class B {
+ void m(int i) {}
+}
+team class MyTeam {
+ protected class R extends A playedBy B {
+ void m(int i) -> void m(int i);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_out.java
new file mode 100644
index 000000000..63d53d9cb
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd02_out.java
@@ -0,0 +1,12 @@
+package p;
+abstract class A{
+ abstract void m(int i, int x);
+}
+class B {
+ void m(int i) {}
+}
+team class MyTeam {
+ protected class R extends A playedBy B {
+ void m(int i, int x) -> void m(int i);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_in.java
new file mode 100644
index 000000000..d6943db8f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_in.java
@@ -0,0 +1,10 @@
+package p;
+team class A{
+ void m(int i);
+ protected class R extends A playedBy B {
+ void m(int i) <- after void b(int i);
+ }
+}
+class B {
+ void b(int i) {}
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_out.java
new file mode 100644
index 000000000..100b7ad1b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd03_out.java
@@ -0,0 +1,10 @@
+package p;
+team class A{
+ void m(int i, int x);
+ protected class R extends A playedBy B {
+ void m(int i, int x) <- after void b(int i);
+ }
+}
+class B {
+ void b(int i) {}
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_in.java
new file mode 100644
index 000000000..997b7b43d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_in.java
@@ -0,0 +1,10 @@
+package p;
+class A{
+ private void m(int i){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void rm(int i) -> void m(int i);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_out.java
new file mode 100644
index 000000000..41ad4f71c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testAdd04_out.java
@@ -0,0 +1,10 @@
+package p;
+class A{
+ private void m(int i, int x){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void rm(int i) -> void m(int i, int x);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_in.java
new file mode 100644
index 000000000..658f9e514
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_in.java
@@ -0,0 +1,11 @@
+package p;
+class A{
+ private void m(int i, int x){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void m(int i) <- after void m(int i, int x);
+ void m(int i) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_out.java
new file mode 100644
index 000000000..d5e81900d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete01_out.java
@@ -0,0 +1,18 @@
+package p;
+class A{
+ /**
+ * @deprecated Use {@link #m(int)} instead
+ */
+ private void m(int i, int x){
+ m(i);
+ }
+
+ private void m(int i){
+ }
+}
+team class MyTeam {
+ protected class R playedBy A {
+ void m(int i) <- after void m(int i);
+ void m(int i) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_in.java
new file mode 100644
index 000000000..63d53d9cb
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_in.java
@@ -0,0 +1,12 @@
+package p;
+abstract class A{
+ abstract void m(int i, int x);
+}
+class B {
+ void m(int i) {}
+}
+team class MyTeam {
+ protected class R extends A playedBy B {
+ void m(int i, int x) -> void m(int i);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_out.java
new file mode 100644
index 000000000..19f0e2737
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testDelete02_out.java
@@ -0,0 +1,12 @@
+package p;
+abstract class A{
+ abstract void m(int i);
+}
+class B {
+ void m(int i) {}
+}
+team class MyTeam {
+ protected class R extends A playedBy B {
+ void m(int i) -> void m(int i);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_in.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_in.java
new file mode 100644
index 000000000..e585a9101
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_in.java
@@ -0,0 +1,16 @@
+package p;
+class A {
+ void m(int a, boolean b, String ignore) {}
+}
+class B {
+ void bm(int a2, boolean b2) {}
+}
+team class MyTeam {
+ protected class R1 extends A playedBy B {
+ void m(int a, boolean b, String ignore) => bm(int a2, boolean b2);
+ }
+ protected class R2 playedBy A {
+ void n(int a3, boolean b3) <- replace void m(int a, boolean b, String ignore);
+ callin void n(int a3, boolean b3) {}
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_out.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_out.java
new file mode 100644
index 000000000..77c95a840
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/testdata/ChangeSignature/canModify/A_testReorder01_out.java
@@ -0,0 +1,22 @@
+package p;
+class A {
+ void m(String ignore, boolean b, int a) {}
+}
+class B {
+ void bm(int a2, boolean b2) {}
+}
+team class MyTeam {
+ protected class R1 extends A playedBy B {
+ void m(String ignore, boolean b, int a) => bm(int a2, boolean b2) with {
+ b -> b2,
+ a -> a2
+ }
+ }
+ protected class R2 playedBy A {
+ void n(int a3, boolean b3) <- replace void m(String ignore, boolean b, int a) with {
+ b3 <- b,
+ a3 <- a
+ }
+ callin void n(int a3, boolean b3) {}
+ }
+} \ No newline at end of file

Back to the top