diff options
author | Stephan Herrmann | 2020-04-11 12:28:09 +0000 |
---|---|---|
committer | Stephan Herrmann | 2020-04-11 12:28:09 +0000 |
commit | c4606e8c36137ec06dbe7f751e5a1b6fe3148e55 (patch) | |
tree | c4e3c0787b3b203dc4cd5446a35f0229a343bb5a /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org | |
parent | bcd16035e3129a4b2ef22ffacae59d6a5ab65085 (diff) | |
download | org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.tar.gz org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.tar.xz org.eclipse.objectteams-c4606e8c36137ec06dbe7f751e5a1b6fe3148e55.zip |
Remove trailing whitespace on all lines
- manually replays JDT's 560451
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org')
48 files changed, 697 insertions, 697 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/AllTests.java index e6b6d487f..0dd03a697 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse refactoring tests
*/
public class AllTests
@@ -46,7 +46,7 @@ public class AllTests // util suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.util.AllTests.suite()); -
+
// OTDT refactoring tests
// rename
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenameMethodInInterfaceTests.suite());
@@ -55,11 +55,11 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenameVirtualMethodInClassTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenamePrivateFieldTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenameTypeTests.suite());
-
+
// move
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.move.MoveInstanceMethodTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.move.MoveStaticMethodTests.suite());
-
+
//extract
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractmethod.ExtractMethodRefactoringUtilTests.suite());
@@ -69,15 +69,15 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.OTCopyToClipboardTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.OTDeleteTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.OTPasteActionTest.suite());
-
+
// pull & push
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.pullup.PullUpTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.pushdown.PushDownTests.suite());
-
+
// ot refactorings
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.inlinecallin.InlineCallinTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractcallin.ExtractCallinTests.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/FileBasedRefactoringTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/FileBasedRefactoringTest.java index a3ff3b977..b73c10a2b 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/FileBasedRefactoringTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/FileBasedRefactoringTest.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/MySetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/MySetup.java index 156acddf5..0c8882531 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/MySetup.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/MySetup.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -44,10 +44,10 @@ public class MySetup extends TestSetup private static IPackageFragmentRoot _root;
private static IPackageFragment _packageP;
private static IJavaProject _javaTestProject;
-
+
public static final String CONTAINER = "src";
-
+
public MySetup(Test test)
{
super(test);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestPlugin.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestPlugin.java index f70ba37ef..cca219908 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestPlugin.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestPlugin.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestSetup.java index e159eb5c6..d7b858186 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestSetup.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/OTRefactoringTestSetup.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -41,9 +41,9 @@ public team class OTRefactoringTestSetup extends RefactoringTestSetup { within (this) super.setUp(); } - + protected class ProjectHelper playedBy JavaProjectHelper { - + IJavaProject createJavaProject(String projectName, String binFolderName) <- replace IJavaProject createJavaProject(String projectName, String binFolderName); @SuppressWarnings("basecall") diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/RefactoringTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/RefactoringTest.java index 81cf5e09b..548f59b86 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/RefactoringTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/RefactoringTest.java @@ -1,20 +1,20 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2013 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -419,7 +419,7 @@ public abstract class RefactoringTest extends TestCase protected ICompilationUnit[] createCUs(String[] cuNames) throws Exception { ICompilationUnit[] cus = new ICompilationUnit[cuNames.length]; - + for (int idx = 0; idx < cuNames.length; idx++) { Assert.isNotNull(cuNames[idx]); cus[idx] = createCUfromTestFile(getPackageP(), cuNames[idx]); @@ -576,7 +576,7 @@ public abstract class RefactoringTest extends TestCase return getMethods(type, names, signatures, null, false); } public static IMethod[] getMethods(IType type, String[] names, String[][] signatures, - boolean[] flags, boolean flag) + boolean[] flags, boolean flag) throws JavaModelException {
if (names == null || signatures == null)
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/adapt/JdtTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/adapt/JdtTests.java index 62cb0377f..a0af8004e 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/adapt/JdtTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/adapt/JdtTests.java @@ -1,8 +1,8 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2010 GK Software AG - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -10,9 +10,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Stephan Herrmann - Initial API and implementation **********************************************************************/ @@ -28,13 +28,13 @@ import base org.eclipse.jdt.ui.tests.refactoring.RefactoringTest; @SuppressWarnings("restriction") public team class JdtTests { - + protected team class ChangeSignature playedBy ChangeSignatureTests { - + final static String OT_NAME = "a_of_string"; - + testGenerics04 <- replace testGenerics04; - + @SuppressWarnings({ "inferredcallout", "basecall", "decapsulation" }) callin void testGenerics04() throws Exception { String[] signature= {"QList<QInteger;>;", "QA<QString;>;"}; @@ -44,7 +44,7 @@ public team class JdtTests { ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues); int[] newIndices= {2}; -//{ObjectTeams: avoid keyword "as" - renamed to "a_of_string" +//{ObjectTeams: avoid keyword "as" - renamed to "a_of_string" String[] oldParamNames= {"li", OT_NAME}; String[] newParamNames= {"li", OT_NAME}; // SH} @@ -56,7 +56,7 @@ public team class JdtTests { within (this) // OT: enable nested role ContentPatching helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName); } - + protected class ContentPatching playedBy RefactoringTest { String getFileContents(String fileName) <- replace String getFileContents(String fileName); @@ -65,7 +65,7 @@ public team class JdtTests { String orig = base.getFileContents(fileName); // word "as" appears after " ", "\t" and "(", but don't replace in "class": return orig.replaceAll("([ \t(])as", "$1"+OT_NAME); - } + } } } } diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/AllTests.java index 779332965..7d3d34602 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -40,7 +40,7 @@ public class AllTests "All OT-ExtractCallin-Refactoring Tests");
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.extractcallin.ExtractCallinTests.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/ExtractCallinTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/ExtractCallinTests.java index f092d0d29..67dd2028c 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/ExtractCallinTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractcallin/ExtractCallinTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -37,7 +37,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** * @author Johannes Gebauer - * + * */ @SuppressWarnings("restriction") public class ExtractCallinTests extends RefactoringTest { @@ -80,9 +80,9 @@ public class ExtractCallinTests extends RefactoringTest { assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); ref.setDeleteBaseMethod(deleteRoleMethod); - + ref.setCopyBaseMethod(copyBaseMethod); - + RefactoringStatus checkInputResult = ref.checkFinalConditions(new NullProgressMonitor()); assertTrue("precondition was supposed to pass", !checkInputResult.hasError()); performChange(ref, false); @@ -104,27 +104,27 @@ public class ExtractCallinTests extends RefactoringTest { /******* tests ******************/ /* Extract Callin Tests */ - + public void testExtractSimpleBeforeCallin() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[0], CallinMapping.KIND_BEFORE, false, "B", "R", false); } - + public void testExtractSimpleReplaceCallin1() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[0], CallinMapping.KIND_REPLACE, false, "B", "R", true); } - + public void testExtractSimpleAfterCallin() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[0], CallinMapping.KIND_AFTER, false, "B", "R", false); } - + public void testExtractSimpleReplaceCallin2() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[0], CallinMapping.KIND_REPLACE, false, "B", "R", false); } - + public void testExtractCallinWithParameter() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[] { "I" }, CallinMapping.KIND_BEFORE, false, "B", "R", false); } - + public void testExtractCallinWithParameterMapping() throws Exception { performPullUp_pass(new String[] { "B", "T" }, "m", new String[] { "I", "I" }, CallinMapping.KIND_BEFORE, false, "B", "R", false); } diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java index 3ec2b392f..c4a638d72 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AbstractSelectionTestCase.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -54,11 +54,11 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase public static final int SQUARE_BRACKET_OPEN_LENGTH = SQUARE_BRACKET_OPEN.length();
public static final String SQUARE_BRACKET_CLOSE = "/*]*/";
public static final int SQUARE_BRACKET_CLOSE_LENGTH = SQUARE_BRACKET_CLOSE.length();
-
+
protected static final int VALID_SELECTION = 1;
protected static final int INVALID_SELECTION = 2;
protected static final int COMPARE_WITH_OUTPUT = 3;
-
+
public AbstractSelectionTestCase(String name)
{
super(name);
@@ -81,7 +81,7 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase {
excludingStart = -1;
}
-
+
if (includingEnd < excludingEnd)
{
includingEnd = -1;
@@ -90,7 +90,7 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase {
excludingEnd = -1;
}
-
+
if (includingStart != -1)
{
start = includingStart;
@@ -99,7 +99,7 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase {
start = excludingStart + SQUARE_BRACKET_CLOSE_LENGTH;
}
-
+
if (excludingEnd != -1)
{
end = excludingEnd;
@@ -108,37 +108,37 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase {
end = includingEnd + SQUARE_BRACKET_CLOSE_LENGTH;
}
-
+
assertTrue("Selection invalid", start >= 0 && end >= 0 && end >= start);
-
- int[] result = new int[] { start, end - start };
+
+ int[] result = new int[] { start, end - start };
// System.out.println("|"+ source.substring(result[0], result[0] + result[1]) + "|");
return result;
}
-
+
protected ITextSelection getTextSelection(String source)
{
int[] s = getSelection(source);
return new TextSelection(s[0], s[1]);
}
-
+
protected InputStream getFileInputStream(String fileName) throws IOException
{
return OTRefactoringTestPlugin.getDefault().getTestResourceStream(fileName);
}
-
-//{ObjectTeams: fixing a JDT-problem: couldn't cope with package paths > 1
+
+//{ObjectTeams: fixing a JDT-problem: couldn't cope with package paths > 1
protected ICompilationUnit createCU(IPackageFragment pack, String name) throws Exception {
name= adaptName(name);
return createCU(pack, name, getFileInputStream(myGetFilePath(pack, name)));
}
-
+
protected String myGetFilePath(String path, String name) {
return getResourceLocation() + path + "/" + name;
}
-
+
protected String myGetFilePath(IPackageFragment pack, String name) {
- return myGetFilePath(pack.getElementName().replace('.','/'), name); // <-- the patch: force the package path to use '/'
+ return myGetFilePath(pack.getElementName().replace('.','/'), name); // <-- the patch: force the package path to use '/'
}
// SH}
@@ -162,7 +162,7 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase IUndoManager undoManager = RefactoringCore.getUndoManager();
undoManager.flush();
String original = unit.getSource();
-
+
PerformRefactoringOperation op = new PerformRefactoringOperation(
refactoring, getCheckingStyle());
JavaCore.run(op, new NullProgressMonitor());
@@ -181,10 +181,10 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase assertTrue("Undo manager is empty", undoManager.anythingToRedo());
compareSource(original, unit.getSource());
}
- break;
+ break;
}
}
-
+
protected RefactoringStatus checkPreconditions(
Refactoring refactoring,
IProgressMonitor pm) throws CoreException
@@ -194,7 +194,7 @@ public abstract class AbstractSelectionTestCase extends AbstractCUTestCase op.run(new NullProgressMonitor());
return op.getStatus();
}
-
+
protected int getCheckingStyle()
{
return CheckConditionsOperation.ALL_CONDITIONS;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java index ebdcfdd84..b6f90134d 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse refactoring tests
*/
public class AllTests
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodRefactoringUtilTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodRefactoringUtilTests.java index c4737183b..213618621 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodRefactoringUtilTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractMethodRefactoringUtilTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -46,7 +46,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.FileBasedRefactoringTes /**
* @author brcan
- *
+ *
*/
@SuppressWarnings( { "restriction", "nls" })
public class ExtractMethodRefactoringUtilTests extends FileBasedRefactoringTest {
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 d9667c8e9..dbf12fa7c 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 @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -52,7 +52,7 @@ public class ExtractMethodTestSetup extends TestSetup private static final String CONTAINER = "src";
// private IPackageFragment _selectionPackage;
-
+
private IPackageFragment _teamClassPackage;
private IPackageFragment _roleClassPackage;
private IPackageFragment _nestedTeamPackage;
@@ -61,12 +61,12 @@ public class ExtractMethodTestSetup extends TestSetup private IPackageFragment _focusTypePackage;
private IPackageFragment _overloadingPackage; private IPackageFragment _syntaxPackage;
-
+
public ExtractMethodTestSetup(Test test)
{
super(test);
}
-
+
public IPackageFragmentRoot getRoot() {
return _root;
}
@@ -80,12 +80,12 @@ public class ExtractMethodTestSetup extends TestSetup options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
TestOptions.initializeCodeGenerationOptions();
- JavaPlugin.getDefault().getCodeTemplateStore().load();
-
+ JavaPlugin.getDefault().getCodeTemplateStore().load();
+
_javaProject = JavaProjectHelper.createOTJavaProject("TestProject", "bin");
JavaProjectHelper.addRTJar(_javaProject);
_root = JavaProjectHelper.addSourceContainer(_javaProject, CONTAINER);
-
+
RefactoringCore.getUndoManager().flush();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
@@ -110,7 +110,7 @@ public class ExtractMethodTestSetup extends TestSetup JavaProjectHelper.performDummySearch(_javaProject);
JavaProjectHelper.delete(_javaProject);
}
-
+
// public IPackageFragment getSelectionPackage()
// {
// return _selectionPackage;
@@ -125,7 +125,7 @@ public class ExtractMethodTestSetup extends TestSetup {
return _roleClassPackage;
}
-
+
public IPackageFragment getNestedTeamPackage()
{
return _nestedTeamPackage;
@@ -140,12 +140,12 @@ public class ExtractMethodTestSetup extends TestSetup {
return _rolefileParentPackage;
}
-
+
public IPackageFragment getFocusTypePackage()
{
return _focusTypePackage;
}
-
+
public IPackageFragment getOverloadingPackage()
{
return _overloadingPackage;
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 841a130d9..0f8a78dfe 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 @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -42,13 +42,13 @@ import org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodRefactoring /** * @author brcan - * + * */ @SuppressWarnings({ "nls", "restriction" }) public class ExtractMethodTests extends AbstractSelectionTestCase { private static ExtractMethodTestSetup _testSetup; - + public ExtractMethodTests(String name) { super(name); @@ -64,12 +64,12 @@ public class ExtractMethodTests extends AbstractSelectionTestCase { return _testSetup.getRoot(); } - + protected String getResourceLocation() { return "ExtractMethod/"; } - + protected String adaptName(String name) { if (getName().startsWith("testFocusType")) @@ -77,8 +77,8 @@ public class ExtractMethodTests extends AbstractSelectionTestCase return super.adaptName(name); } return name + "_" + getName() + ".java"; - } - + } + // protected void selectionTest(int startLine, int startColumn, int endLine, int endColumn) // throws Exception // { @@ -90,12 +90,12 @@ public class ExtractMethodTests extends AbstractSelectionTestCase // assertEquals(expected.getOffset(), selection[0]); // assertEquals(expected.getLength(), selection[1]); // } -// +// // private IPackageFragment getSelectionPackage() throws JavaModelException // { // return _testSetup.getSelectionPackage(); // } - + protected void performTest( IPackageFragment packageFragment, String[] ids, @@ -104,7 +104,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase { performTest(packageFragment, ids, mode, outputFolder, null, null, 0); } - + protected void performTest( IPackageFragment packageFragment, String[] ids, @@ -156,24 +156,24 @@ public class ExtractMethodTests extends AbstractSelectionTestCase } } refactoring.setDestination(destination); - + String out = null; switch (mode) { case COMPARE_WITH_OUTPUT: out = getProofedContent(outputFolder, ids[0]); - break; + break; } performTest(compUnits[0], refactoring, mode, out, true); } - + private ICompilationUnit[] createCUs( IPackageFragment packageFragment, String[] ids) throws Exception { ICompilationUnit[] cus = new ICompilationUnit[ids.length]; - + for (int idx = 0; idx < ids.length; idx++) { Assert.isNotNull(ids[idx]); @@ -201,7 +201,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase COMPARE_WITH_OUTPUT, "team_out"); } - //extract expression in team + //extract expression in team public void testTeamclass2() throws Exception { performTest( @@ -245,7 +245,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase performTest( _testSetup.getNestedTeamPackage(), new String[]{"T1"}, - COMPARE_WITH_OUTPUT, + COMPARE_WITH_OUTPUT, "nestedTeam_out"); } //extract method invocation in inner role of unbound nested team @@ -254,7 +254,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase performTest( _testSetup.getNestedTeamPackage(), new String[]{"T1"}, - COMPARE_WITH_OUTPUT, + COMPARE_WITH_OUTPUT, "nestedTeam_out"); } @@ -278,7 +278,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase "nestedTeam_out"); } //extract method invocation in bound inner role of nested team -> - //ambiguous base method spec + //ambiguous base method spec public void testNestedTeam5() throws Exception { performTest( @@ -288,7 +288,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase "nestedTeam_out"); } //extract method invocation in bound inner role of nested team -> - //ambiguous role method spec + //ambiguous role method spec public void testNestedTeam6() throws Exception { performTest( @@ -297,7 +297,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "nestedTeam_out"); } - + //===================================================================================== // Testing role files //===================================================================================== @@ -334,7 +334,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase } // ===================================================================================== // Testing overloading and/or ambiguity for different focus types - // ===================================================================================== + // ===================================================================================== //focus implicit role hierarchy public void testFocusTypeIsSuperroleInRoleHierarchy() throws Exception @@ -345,7 +345,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "focusType_out"); } - + public void testFocusTypeIsMiddleRoleInRoleHierarchy() throws Exception { performTest( @@ -371,9 +371,9 @@ public class ExtractMethodTests extends AbstractSelectionTestCase _testSetup.getFocusTypePackage(), new String[] {"A", "B", "C", "T1", "T2", "T3"}, INVALID_SELECTION, - "focusType_out"); + "focusType_out"); } - + public void testFocusTypeIsMiddleBasetypeInBaseHierarchy() throws Exception { performTest( @@ -382,7 +382,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "focusType_out"); } - + public void testFocusTypeIsLowestBasetypeInBaseHierarchy() throws Exception { performTest( @@ -391,7 +391,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "focusType_out"); } - + //focus team hierarchy public void testFocusTypeIsSuperteamInTeamHierachy() throws Exception { @@ -401,7 +401,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "focusType_out"); } - + public void testFocusTypeIsMiddleTeamInTeamHierachy() throws Exception { performTest( @@ -429,7 +429,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "overloading_out"); } - + // role is a indirect subclass of target class, explicit + implicit inheritance, short methodSpec public void test21() throws Exception { @@ -439,7 +439,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "overloading_out"); } - + // role is a indirect subclass of target class, explicit + implicit inheritance, long methodSpec public void test22() throws Exception { @@ -449,8 +449,8 @@ public class ExtractMethodTests extends AbstractSelectionTestCase COMPARE_WITH_OUTPUT, "overloading_out"); } - - // bound base class is target class, short methodSpec + + // bound base class is target class, short methodSpec public void test23() throws Exception { performTest( @@ -459,7 +459,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "overloading_out"); } - + // bound base class is direct/indirect subclass of target class, short methodSpec public void test24() throws Exception { @@ -469,7 +469,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase INVALID_SELECTION, "overloading_out"); } - + // base class is subclass of target class, long methodSpec public void test25() throws Exception { @@ -482,7 +482,7 @@ public class ExtractMethodTests extends AbstractSelectionTestCase // ===================================================================================== // Testing special syntactic nodes - // ===================================================================================== + // ===================================================================================== // call target is a declared-lifting argument public void testDeclaredLifting1() throws Exception diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java index 809cc1f50..b0f481d00 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTestSetup.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -56,7 +56,7 @@ public class ExtractTempTestSetup extends TestSetup {
super(test);
}
-
+
public IPackageFragmentRoot getRoot() {
return _root;
}
@@ -69,12 +69,12 @@ public class ExtractTempTestSetup extends TestSetup options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
TestOptions.initializeCodeGenerationOptions();
- JavaPlugin.getDefault().getCodeTemplateStore().load();
-
+ JavaPlugin.getDefault().getCodeTemplateStore().load();
+
_javaProject = JavaProjectHelper.createOTJavaProject("TestProject", "bin");
JavaProjectHelper.addRTJar(_javaProject);
_root = JavaProjectHelper.addSourceContainer(_javaProject, CONTAINER);
-
+
RefactoringCore.getUndoManager().flush();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
@@ -90,7 +90,7 @@ public class ExtractTempTestSetup extends TestSetup JavaProjectHelper.performDummySearch(_javaProject);
JavaProjectHelper.delete(_javaProject);
}
-
+
public IPackageFragment getStatementsPackage()
{
return _statementsPackage;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java index 6540747ef..d07f7d710 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/extractmethod/ExtractTempTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -38,7 +38,7 @@ import org.eclipse.ltk.core.refactoring.RefactoringStatus; /** * @author stephan - * + * */ @SuppressWarnings("restriction") public class ExtractTempTests extends AbstractSelectionTestCase @@ -60,12 +60,12 @@ public class ExtractTempTests extends AbstractSelectionTestCase { return _testSetup.getRoot(); } - + protected String getResourceLocation() { return "ExtractTemp/"; } - + protected String adaptName(String name) { if (getName().startsWith("testFocusType")) @@ -73,8 +73,8 @@ public class ExtractTempTests extends AbstractSelectionTestCase return super.adaptName(name); } return name + "_" + getName() + ".java"; - } - + } + protected void performTest( int startLine, int startColumn, @@ -85,12 +85,12 @@ public class ExtractTempTests extends AbstractSelectionTestCase { performTest(_testSetup.getStatementsPackage(), new String[]{"T"}, - startLine, - startColumn, endLine, endColumn, - COMPARE_WITH_OUTPUT, declareFinal, + startLine, + startColumn, endLine, endColumn, + COMPARE_WITH_OUTPUT, declareFinal, outputFolder); } - + protected void performTest( IPackageFragment packageFragment, String[] ids, @@ -103,7 +103,7 @@ public class ExtractTempTests extends AbstractSelectionTestCase { performTest(packageFragment, ids, startLine, startColumn, endLine, endColumn, mode, false, outputFolder); } - + protected void performTest( IPackageFragment packageFragment, String[] ids, @@ -134,24 +134,24 @@ public class ExtractTempTests extends AbstractSelectionTestCase if (!status.isOK()) return; } - + String out = null; switch (mode) { case COMPARE_WITH_OUTPUT: out = getProofedContent(outputFolder, ids[0]); - break; + break; } performTest(compUnits[0], refactoring, mode, out, true); } - + private ICompilationUnit[] createCUs( IPackageFragment packageFragment, String[] ids) throws Exception { ICompilationUnit[] cus = new ICompilationUnit[ids.length]; - + for (int idx = 0; idx < ids.length; idx++) { Assert.isNotNull(ids[idx]); @@ -184,9 +184,9 @@ public class ExtractTempTests extends AbstractSelectionTestCase false, "statements_out"); } - + // two element path, extracted is a dependent type - public void testTypeAnchor1() throws Exception + public void testTypeAnchor1() throws Exception { performTest(15,13,15,18, true, @@ -194,7 +194,7 @@ public class ExtractTempTests extends AbstractSelectionTestCase } // three element path, extracted is not a dependent type - public void testTypeAnchor2() throws Exception + public void testTypeAnchor2() throws Exception { performTest(21,13,21,20, true, @@ -202,7 +202,7 @@ public class ExtractTempTests extends AbstractSelectionTestCase } // three element path, extracted is a dependent type - public void testTypeAnchor3() throws Exception + public void testTypeAnchor3() throws Exception { performTest(19,13,19,20, true, diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/AllTests.java index fda71df73..f8218a545 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -40,7 +40,7 @@ public class AllTests "All OT-InlineCallin-Refactoring Tests");
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.inlinecallin.InlineCallinTests.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/InlineCallinTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/InlineCallinTests.java index 0c43314b3..b6373a423 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/InlineCallinTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/inlinecallin/InlineCallinTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -42,7 +42,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.MySetup; import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** - * + * * @author Johannes Gebauer */ @SuppressWarnings("restriction") @@ -79,7 +79,7 @@ public class InlineCallinTests extends RefactoringTest { /** * The <code>ICompilationUnit</code> containing the role that defines the * <code>ICallinMapping</code> at position 0 and its base at position 1. - * + * */ private void performInlineCallin_pass(String[] cuNames, String roleMethodName, String[] roleMethodSignature, String[] baseMethodNames, String[][] baseMethodSignatures, int[] mappingKinds, boolean deleteRoleMethod, String roleName, String baseName) throws Exception { @@ -98,7 +98,7 @@ public class InlineCallinTests extends RefactoringTest { assertTrue("base method " + baseMethods[i].getElementName() + " does not exist", baseMethods[i].exists()); } - + ICallinMapping[] mappings = new ICallinMapping[baseMethodNames.length]; for (int i = 0; i < mappings.length; i++) { mappings[i] = getCallinMethodMapping(roleType, roleMethod, baseMethods[i], mappingKinds[i]); @@ -110,7 +110,7 @@ public class InlineCallinTests extends RefactoringTest { assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); ref.setDeleteRoleMethod(deleteRoleMethod); - + RefactoringStatus checkInputResult = ref.checkFinalConditions(new NullProgressMonitor()); assertTrue("precondition was supposed to pass", !checkInputResult.hasError()); performChange(ref, false); @@ -128,11 +128,11 @@ public class InlineCallinTests extends RefactoringTest { } } - + /** * The <code>ICompilationUnit</code> containing the role that defines the * <code>ICallinMapping</code> at position 0 and its base at position 1. - * + * */ private void performInlineCallin_failing(String[] cuNames, String roleMethodName, String[] roleMethodSignature, String[] baseMethodNames, String[][] baseMethodSignatures, int[] mappingKinds, boolean deleteRoleMethod, String roleName, String baseName) throws Exception { @@ -163,12 +163,12 @@ public class InlineCallinTests extends RefactoringTest { assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); ref.setDeleteRoleMethod(deleteRoleMethod); - + RefactoringStatus result = performRefactoring(ref); assertNotNull("precondition was supposed to fail.", result); assertTrue("precondition was supposed to fail.", !result.isOK()); assertNotNull("precondition result is expected to contain an error.", result.getEntryMatchingSeverity(RefactoringStatus.ERROR)); - + } finally { performDummySearch(); for (int i = 0; i < cus.length; i++) { @@ -181,13 +181,13 @@ public class InlineCallinTests extends RefactoringTest { private ICallinMapping getCallinMethodMapping(IType roleType, IMethod roleMethod, IMethod baseMethod, int mappingKind) throws JavaModelException { IRoleType role = (IRoleType) OTModelManager.getOTElement(roleType); assertNotNull("type " + roleType.getElementName() + " is not a role", role); - + IMethodMapping[] mappings = role.getMethodMappings(); - + for (int i = 0; i < mappings.length; i++) { if (mappings[i] instanceof ICallinMapping) { ICallinMapping mapping = (ICallinMapping) mappings[i]; - + for (int j = 0; j < mapping.getBoundBaseMethods().length; j++) { IMethod roleMethod2 = mapping.getRoleMethod(); IMethod baseMethod2 = mapping.getBoundBaseMethods()[j]; @@ -199,12 +199,12 @@ public class InlineCallinTests extends RefactoringTest { } return null; } - + /******* tests ******************/ /* Inline Callin Tests */ - + public void testSimpleBeforeCallin() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_BEFORE }, false, "R", "B"); } @@ -217,12 +217,12 @@ public class InlineCallinTests extends RefactoringTest { public void testSimpleReplaceCallin() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testAfterCallinWithReturn() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); - } - + } + public void testReplaceCallinResultTunneling1() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); @@ -231,25 +231,25 @@ public class InlineCallinTests extends RefactoringTest { public void testReplaceCallinResultTunneling2() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testReplaceCallinWithReturn() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testDifferentParamNames() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I" }, new String[] { "m" }, new String[][] { new String[] { "I" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); - } - + } + public void testDifferentParamLength() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I" }, new String[] { "m" }, new String[][] { new String[] { "I", "QString;" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); - } - + } + public void testDifferentParamLengthBeforeCallin() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I" }, new String[] { "m" }, new String[][] { new String[] { "I", "QString;" } }, new int[] { CallinMapping.KIND_BEFORE }, false, "R", "B"); - } - + } + public void testSimpleParameterMapping() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I" }, new String[] { "m" }, new String[][] { new String[] { "I", "I" } }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); @@ -259,83 +259,83 @@ public class InlineCallinTests extends RefactoringTest { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I" }, new String[] { "m" }, new String[][] { new String[] { "I", "I" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testReplaceCallinWithMultipleReturns() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testReplaceCallinWithParameter() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[] { "I", "QString;" }, new String[] { "m" }, new String[][] { new String[] { "I", "QString;" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testCallinMappingWithSignature() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testMultipleBaseMethodCallin() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testRoleMethodReferencesCallout() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testRoleMethodReferencesCalloutToFieldGet() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testRoleMethodReferencesCalloutToFieldSet() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testParameterTunneling1() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[] { "I" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); - } - + } + public void testParameterTunneling2() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[] { "I" } }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); - } - + } + public void testInlineMultipleCallins() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m1", "m2" }, new String[][] { new String[0], new String[0] }, new int[] { CallinMapping.KIND_AFTER, CallinMapping.KIND_AFTER }, false, "R", "B"); } - + public void testDeleteRoleMethod() throws Exception { performInlineCallin_pass(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, true, "R", "B"); } - + public void testDeleteReferencedRoleMethod() throws Exception { performInlineCallin_failing(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_BEFORE }, true, "R", "B"); } - + public void testInlineBoundCallin1() throws Exception { performInlineCallin_failing(new String[] { "T1", "B", "T2" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testInlineBoundCallin2() throws Exception { performInlineCallin_failing(new String[] { "T1", "B", "T2" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_REPLACE }, false, "R", "B"); } - + public void testDependencyToRole1() throws Exception { performInlineCallin_failing(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_BEFORE }, false, "R", "B"); } - + public void testDependencyToRole2() throws Exception { performInlineCallin_failing(new String[] { "T", "B" }, "n", new String[0], new String[] { "m" }, new String[][] { new String[0] }, new int[] { CallinMapping.KIND_BEFORE }, false, "R", "B"); } - + } 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 index 6d7ae14ec..5b9f0b80c 100644 --- 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 @@ -1,17 +1,17 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2010 GK Software AG - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Stephan Herrmann - Initial API and implementation **********************************************************************/ @@ -50,12 +50,12 @@ 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) { @@ -170,7 +170,7 @@ public class ChangeSignatureTests extends RefactoringTest { } void helperDelete(ICompilationUnit cu, IType declaringClass, String[] signature, int[] deleteIndices, boolean createDelegate, String expectedInfo) - throws JavaModelException, CoreException, Exception, IOException + throws JavaModelException, CoreException, Exception, IOException { IMethod method = declaringClass.getMethod("m", signature); assertTrue("method does not exist", method.exists()); @@ -202,7 +202,7 @@ public class ChangeSignatureTests extends RefactoringTest { } void helperRename(ICompilationUnit cu, IType declaringClass, String[] signature, int idx, String oldName, String newName, String expectedInfo) - throws JavaModelException, CoreException, Exception, IOException + throws JavaModelException, CoreException, Exception, IOException { IMethod method = declaringClass.getMethod("m", signature); assertTrue("method does not exist", method.exists()); @@ -234,7 +234,7 @@ public class ChangeSignatureTests extends RefactoringTest { // from RenameTempTests with adaptation: private void helperRegularRename(String newName, boolean updateReferences, IJavaElement element, ICompilationUnit cu, // new for OT: don't use automatic outfile name - String outFileName) + String outFileName) throws Exception { assertTrue(element.getClass().toString(), element instanceof ILocalVariable); @@ -340,7 +340,7 @@ public class ChangeSignatureTests extends RefactoringTest { assertNotNull("precondition was supposed to have an error", result); assertFalse("result was not supposed to be OK", result.isOK()); } else { - assertEquals("precondition was supposed to pass", null, result); + assertEquals("precondition was supposed to pass", null, result); } IPackageFragment pack= (IPackageFragment)cu.getParent(); @@ -446,7 +446,7 @@ public class ChangeSignatureTests extends RefactoringTest { helperRename(cu, teamType, new String[]{"QA;"}, 0, "arg", "renamed", null); } - // simulate performing the same operation as testRename01() triggered by Shift-Alt-R: + // simulate performing the same operation as testRename01() triggered by Shift-Alt-R: public void testRename01a() throws Exception { boolean canRename = true; String simpleTestFileName = "A_testRename01_in.java"; diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/AllTests.java index 458478a93..7f0696912 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests for this package (move)
*/
public class AllTests
@@ -48,7 +48,7 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.move.MoveStaticMethodTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.move.MoveRoleTests.suite()); suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.move.MoveBaseClassTests.suite()); -
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveBaseClassTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveBaseClassTests.java index 855e2014b..424878010 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveBaseClassTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveBaseClassTests.java @@ -1,17 +1,17 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2012 Stephan Herrmann. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Stephan Herrmann - Initial API and implementation **********************************************************************/ @@ -44,39 +44,39 @@ public team class MoveBaseClassTests extends TestCase { @SuppressWarnings("decapsulation") protected class MoveBaseClass playedBy MoveTest { - + void setUp() -> void setUp(); void tearDown() -> void tearDown(); - + public MoveBaseClass() { base(MoveBaseClass.class.getName()); } - + @SuppressWarnings("inferredcallout") public void testDestination_yes_baseTypeToDifferentPackage() throws Exception{ ParticipantTesting.reset(); IPackageFragment packB = getRoot().createPackageFragment("b", true, null); IPackageFragment packBTemp = getRoot().createPackageFragment("b.temp", true, null); ICompilationUnit cuB= packB.createCompilationUnit("B.java", "package b;public class B {}", true, null); - ICompilationUnit cuT= getPackageP().createCompilationUnit("T1.java", + ICompilationUnit cuT= getPackageP().createCompilationUnit("T1.java", "package p;\n" + "import base b.B;\n" + - "team class T1{void foo(){}protected class Role playedBy B{}}", + "team class T1{void foo(){}protected class Role playedBy B{}}", false, new NullProgressMonitor()); IType baseType = cuB.getTypes()[0]; IJavaElement[] javaElements= {baseType}; IResource[] resources= {}; JavaMoveProcessor ref= verifyEnabled(resources, javaElements, createReorgQueries()); - + Object destination= packBTemp; verifyValidDestination(ref, destination); - + RefactoringStatus status= performRefactoring(ref, true); assertEquals(null, status); - + // expect that base import has been updated in cuT: - String expectedSource2= + String expectedSource2= "package p;\n" + "import base b.temp.B;\n" + "team class T1{void foo(){}protected class Role playedBy B{}}"; @@ -104,13 +104,13 @@ public team class MoveBaseClassTests extends TestCase { setupProject(); this.mover.setUp(); } - + @Override protected void tearDown() throws Exception { super.tearDown(); this.mover.tearDown(); } - + void setupProject() throws Exception { if (!this.projectInitialized) { this.projectInitialized = true; diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveInstanceMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveInstanceMethodTests.java index 9b41ff1aa..39568d77b 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveInstanceMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveInstanceMethodTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -45,7 +45,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /**
* @author brcan
- *
+ *
*/
@SuppressWarnings({ "restriction", "nls" })
public class MoveInstanceMethodTests extends RefactoringTest
@@ -174,12 +174,12 @@ public class MoveInstanceMethodTests extends RefactoringTest }
assertTrue("precondition was supposed to pass", preconditionResult .isOK());
-
+
assertFalse("no warnings expected", preconditionResult.hasWarning());
} else {
assertTrue("warning expected", preconditionResult.hasWarning());
}
-
+
performChange(ref, false);
for (int idx = 0; idx < cus.length; idx++)
{
@@ -232,7 +232,7 @@ public class MoveInstanceMethodTests extends RefactoringTest preconditionResult.merge(ref.checkFinalConditions(new NullProgressMonitor())); assertTrue("expected a warning", preconditionResult.hasInfo()); assertEquals("expected specific warning", expectedWarning, preconditionResult.getMessageMatchingSeverity(RefactoringStatus.INFO)); - + performChange(ref, false); for (int idx = 0; idx < cus.length; idx++) { @@ -253,7 +253,7 @@ public class MoveInstanceMethodTests extends RefactoringTest Assert.isTrue(selectionCuIndex != -1,
"parameter selectionCuQName must match some String in cuQNames.");
performRefactoring_failing(cuQNames, selectionCuIndex, startLine, startColumn,
- endLine, endColumn, newReceiverType, newReceiverName,
+ endLine, endColumn, newReceiverType, newReceiverName,
null, inlineDelegator, removeDelegator, errorCode);
}
@@ -307,7 +307,7 @@ public class MoveInstanceMethodTests extends RefactoringTest assertEquals(errorCode, result.getEntryMatchingSeverity(
RefactoringStatus.ERROR).getCode());
}
- }
+ }
private void performConditionChecking_warnings(
String[] cuQNames, String selectionCuQName,
@@ -360,7 +360,7 @@ public class MoveInstanceMethodTests extends RefactoringTest assertEquals(errorCode, result.getEntryMatchingSeverity(
RefactoringStatus.WARNING).getCode());
}
- }
+ }
protected ICompilationUnit[] createCUs(String[] qualifiedNames)
throws Exception
@@ -426,7 +426,7 @@ public class MoveInstanceMethodTests extends RefactoringTest }
/********** tests *********/
-// test method template
+// test method template
// public void test0() throws Exception
// {
// helper1(new String[] { "p1.A", "p2.B", "p3.C" }, "p1.A", 7, 17, 7, 20,
@@ -434,11 +434,11 @@ public class MoveInstanceMethodTests extends RefactoringTest // }
// public void testFail0() throws Exception
// {
-// failHelper1("p1.IA", 5, 17, 5, 20, PARAMETER, "b", true, true, RefactoringStatusCodes.SELECT_METHOD_IMPLEMENTATION);
+// failHelper1("p1.IA", 5, 17, 5, 20, PARAMETER, "b", true, true, RefactoringStatusCodes.SELECT_METHOD_IMPLEMENTATION);
// }
// TODO(SH): more tests for combinations of inline,removeDelegate!
-
+
/* Testing receiver types */
public void testFieldNewReceiver() throws Exception { performAndCheckSelectedCU_passing(new String[] { "p.A", "p.B" }, "p.A", 7, 17, 7, 19, FIELD, "b", true, true, @@ -689,7 +689,7 @@ public class MoveInstanceMethodTests extends RefactoringTest "p.A", 6, 17, 6, 18, PARAMETER, "b",
true, true, OTRefactoringStatusCodes.DUPLICATE_METHOD_IN_NEW_RECEIVER);
}
-
+
public void _testDuplicateMethodInNewParameterReceiver2()
throws Exception
{
@@ -698,7 +698,7 @@ public class MoveInstanceMethodTests extends RefactoringTest "p.A", 8, 17, 8, 18, PARAMETER, "b",
true, true, OTRefactoringStatusCodes.DUPLICATE_METHOD_IN_NEW_RECEIVER);
}
-
+
public void _testTargetMethodIsPrivate()
throws Exception
{
@@ -707,5 +707,5 @@ public class MoveInstanceMethodTests extends RefactoringTest "p.A", 6, 18, 6, 20, PARAMETER, "b",
true, true, OTRefactoringStatusCodes.CANNOT_MOVE_PRIVATE);
}
-
+
}
\ No newline at end of file diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveMethodTests.java index d1d09f6c4..0b655ba29 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveMethodTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -34,10 +34,10 @@ public class MoveMethodTests public static Test suite()
{
TestSuite suite = new TestSuite(MoveMethodTests.class.getName());
-
+
suite.addTest(MoveInstanceMethodTests.suite());
suite.addTest(MoveStaticMethodTests.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveRoleTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveRoleTests.java index 694aeecdc..48b9caabd 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveRoleTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveRoleTests.java @@ -1,17 +1,17 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2011 Stephan Herrmann. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Stephan Herrmann - Initial API and implementation **********************************************************************/ @@ -43,15 +43,15 @@ public team class MoveRoleTests extends TestCase { @SuppressWarnings("decapsulation") protected class MoveRole playedBy MoveTest { - + void setUp() -> void setUp(); void tearDown() -> void tearDown(); - + public MoveRole() { base(MoveRole.class.getName()); } - + @SuppressWarnings("inferredcallout") public void testDestination_yes_roleTypeToDifferentTeam() throws Exception{ ParticipantTesting.reset(); @@ -65,20 +65,20 @@ public team class MoveRoleTests extends TestCase { IJavaElement[] javaElements= { roleType }; IResource[] resources= {}; JavaMoveProcessor ref= verifyEnabled(resources, javaElements, createReorgQueries()); - + Object destination= cu2.getTypes()[0]; verifyValidDestination(ref, destination); - + RefactoringStatus status= performRefactoring(ref, true); assertEquals(null, status); - + // expect that base import has been added to cu2: String expectedSource2= "package p;\nimport base b.B;\nteam class T2{protected class Role playedBy B{}\n\nvoid bar(){}}"; assertEqualLines("source compare failed", expectedSource2, cu2.getSource()); // expect that base import has been removed from cu1: String expectedSource1= "package p;team class T1{void foo(){}}"; - assertEqualLines("source compare failed", expectedSource1, cu1.getSource()); + assertEqualLines("source compare failed", expectedSource1, cu1.getSource()); } } @@ -102,13 +102,13 @@ public team class MoveRoleTests extends TestCase { setupProject(); this.mover.setUp(); } - + @Override protected void tearDown() throws Exception { super.tearDown(); this.mover.tearDown(); } - + void setupProject() throws Exception { if (!this.projectInitialized) { this.projectInitialized = true; diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveStaticMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveStaticMethodTests.java index c448305a6..c6ac7c259 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveStaticMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/move/MoveStaticMethodTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -46,7 +46,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; *<code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse.
*
* @author brcan
- *
+ *
*/
public class MoveStaticMethodTests extends RefactoringTest
{
@@ -220,7 +220,7 @@ public class MoveStaticMethodTests extends RefactoringTest cuB.delete(false, null);
}
}
-
+
/********** tests *********/
public void test0() throws Exception
{
@@ -544,7 +544,7 @@ public class MoveStaticMethodTests extends RefactoringTest RefactoringStatus.ERROR,
"p.B");
}
-
+
public void testMoveToTeamclass() throws Exception
{
methodHelper_passing(new String[] { "m" }, new String[][] { new String[0] }, "B", "T");
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/AllTests.java index 88833dcb4..6298f4e66 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author jogeb
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse
* refactoring tests
*/
@@ -46,7 +46,7 @@ public class AllTests "All OT-PullUp-Refactoring Tests");
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.pullup.PullUpTests.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/PullUpTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/PullUpTests.java index e6f88be0b..fa8a14fe8 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/PullUpTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/PullUpTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -51,7 +51,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** * Example TestCase to practice testing for the diploma thesis. - * + * * @author Johannes Gebauer */ @SuppressWarnings("restriction") @@ -103,7 +103,7 @@ public class PullUpTests extends RefactoringTest { /** * The <code>ICompilationUnit</code> containing the declaring type must be * at position 0. - * + * * @param fieldNames * TODO */ @@ -116,8 +116,8 @@ public class PullUpTests extends RefactoringTest { performPullUp_pass(cuNames, methodNames, signatures, makeAbstract, fieldNames, deleteAllInSourceType, deleteAllMatchingMethods, targetClassIndex, nameOfDeclaringType, false/*replace*/); } private void performPullUp_pass(String[] cuNames, String[] methodNames, String[][] signatures, boolean[] makeAbstract, String[] fieldNames, - boolean deleteAllInSourceType, boolean deleteAllMatchingMethods, int targetClassIndex, String nameOfDeclaringType, boolean replace) - throws Exception + boolean deleteAllInSourceType, boolean deleteAllMatchingMethods, int targetClassIndex, String nameOfDeclaringType, boolean replace) + throws Exception { ICompilationUnit[] cus = createCUs(cuNames); try { @@ -180,9 +180,9 @@ public class PullUpTests extends RefactoringTest { PullUpRefactoringProcessor processor = createRefactoringProcessor(methods); Refactoring ref = processor.getRefactoring(); - + assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); - + setTargetClass(processor, targetClassIndex); if (deleteAllInSourceType) @@ -210,13 +210,13 @@ public class PullUpTests extends RefactoringTest { } } - + private void performPullUp_failing(String[] cuNames, String[] methodNames, String[][] signatures, String[] fieldNames, boolean deleteAllInSourceType, boolean deleteAllMatchingMethods, int targetClassIndex, String nameOfDeclaringType) throws Exception { performPullUp_failing(cuNames, methodNames, signatures, null, fieldNames, deleteAllInSourceType, deleteAllMatchingMethods, targetClassIndex, nameOfDeclaringType, null); - } + } private void performPullUp_failing(String[] cuNames, String[] methodNames, String[][] signatures, boolean[] makeAbstract, String[] fieldNames, boolean deleteAllInSourceType, boolean deleteAllMatchingMethods, int targetClassIndex, String nameOfDeclaringType, String[] errorMessages) throws Exception @@ -266,7 +266,7 @@ public class PullUpTests extends RefactoringTest { /******* tests ******************/ /* Pull up Method Tests */ - + public void testPullUpBoundMethod() throws Exception { performPullUp_warning(new String[] { "B", "BSuper", "T" }, new String[] { "bm" }, new String[][] { new String[0] }, true, false, 0, "B"); } @@ -325,25 +325,25 @@ public class PullUpTests extends RefactoringTest { } /* Pull up Field Tests */ - + public void testPullUpAnchoredTypeField() throws Exception { performPullUp_failing(new String[] { "T2", "T1", "T3" }, new String[] {}, new String[][] { new String[0] }, new String[] { "extern" }, true, false, 0, "T2"); } - + public void testPulledUpFieldWillBeShadowed() throws Exception { performPullUp_failing(new String[] { "T2", "T1", "T3" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, true, false, 0, "Role"); } - + public void testPullUpCalloutFieldInBase() throws Exception { performPullUp_pass(new String[] { "B1", "B2", "T" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, true, false, 0, "B1"); } - + public void testPullUpFieldToImplicitSuperclass() throws Exception { performPullUp_pass(new String[] { "T", "TSuper" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, true, false, 0, "R"); } - + // Bug 374841 - [refactoring] pull up does not work among (nested) roles public void testPullUpWithReferenceToCallout1() throws Exception { // without pull-up of getS1/getS2 we cannot succeed: @@ -351,35 +351,35 @@ public class PullUpTests extends RefactoringTest { } // Bug 386587 - [refactoring] pull-up refactoring cannot handle callout bindings public void testPullUpWithReferenceToCallout2() throws Exception { - performPullUp_pass(new String[] {"T", "B"}, - new String[]{"foo", "getS1", "getS2"}, - new String[][] { new String[0], new String[0], new String[0] }, - new boolean[] {false, true, true}, + performPullUp_pass(new String[] {"T", "B"}, + new String[]{"foo", "getS1", "getS2"}, + new String[][] { new String[0], new String[0], new String[0] }, + new boolean[] {false, true, true}, new String[0], true, true, 0, "RSub", true /*replace*/); } // Bug 386814 - [refactoring] pull-up should distinguish callouts that can be pull-up vs. abstract decl. public void testPullUpCallout1() throws Exception { - performPullUp_failing(new String[] {"T", "B"}, - new String[]{"foo", "getS1", "getS2"}, - new String[][] { new String[0], new String[0], new String[0] }, - new boolean[] {false, false, true}, // true pull up of callout not possible + performPullUp_failing(new String[] {"T", "B"}, + new String[]{"foo", "getS1", "getS2"}, + new String[][] { new String[0], new String[0], new String[0] }, + new boolean[] {false, false, true}, // true pull up of callout not possible new String[0], true, true, 0, "RSub", new String[]{"The callout binding 'getS1() -> String s' can only be moved to a bound role (OTJLD \u00A73.1.(a))."}); } // Bug 386814 - [refactoring] pull-up should distinguish callouts that can be pull-up vs. abstract decl. public void testPullUpCallout2() throws Exception { - performPullUp_pass(new String[] {"T", "B0", "B1", "B2"}, - new String[]{"foo", "getS1", "getS2"}, - new String[][] { new String[0], new String[0], new String[0] }, - new boolean[] {false, false, false}, // true pull up of callout + performPullUp_pass(new String[] {"T", "B0", "B1", "B2"}, + new String[]{"foo", "getS1", "getS2"}, + new String[][] { new String[0], new String[0], new String[0] }, + new boolean[] {false, false, false}, // true pull up of callout new String[0], true, true, 0, "RSub"); } // Bug 386814 - [refactoring] pull-up should distinguish callouts that can be pull-up vs. abstract decl. public void testPullUpCallout3() throws Exception { - performPullUp_failing(new String[] {"T", "B0", "B1", "B2"}, - new String[]{"foo", "getS1", "getS2"}, - new String[][] { new String[0], new String[0], new String[0] }, + performPullUp_failing(new String[] {"T", "B0", "B1", "B2"}, + new String[]{"foo", "getS1", "getS2"}, + new String[][] { new String[0], new String[0], new String[0] }, new boolean[] {false, false, false}, // true pull up of callout, which are NOT available in super base (B1) new String[0], true, true, 0, "RSub", new String[]{ diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/AllTests.java index ea126bb37..3bd03de77 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author jogeb
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse
* refactoring tests
*/
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/PushDownTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/PushDownTests.java index 99dae77b9..5f62ee443 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/PushDownTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pushdown/PushDownTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -42,9 +42,9 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** * Copy of {@link org.eclipse.jdt.ui.tests.refactoring.PushDownTests}. - * + * * @author Johannes Gebauer - * + * */ @SuppressWarnings({ "nls", "restriction" }) public class PushDownTests extends RefactoringTest { @@ -54,11 +54,11 @@ public class PushDownTests extends RefactoringTest { public PushDownTests(String name) { super(name); } - + protected String getRefactoringPath() { return REFACTORING_PATH; } - + public static Test suite() { return new MySetup(new TestSuite(PushDownTests.class)); @@ -96,7 +96,7 @@ public class PushDownTests extends RefactoringTest { } } - + private void performPushDown_fail(String[] cuNames, String[] methodNames, String[][] signatures, String[] fieldNames, String nameOfDeclaringType) throws Exception { ICompilationUnit[] cus = createCUs(cuNames); @@ -111,7 +111,7 @@ public class PushDownTests extends RefactoringTest { Refactoring ref = processor.getRefactoring(); assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); - + RefactoringStatus result = performRefactoring(ref); assertNotNull("precondition was supposed to fail.", result); assertTrue("precondition was supposed to fail.", !result.isOK()); @@ -125,7 +125,7 @@ public class PushDownTests extends RefactoringTest { } } - + private static PushDownRefactoringProcessor createRefactoringProcessor(IMember[] methods) throws JavaModelException { if (RefactoringAvailabilityTester.isPullUpAvailable(methods)) { PushDownRefactoringProcessor processor = new PushDownRefactoringProcessor(methods); @@ -134,40 +134,40 @@ public class PushDownTests extends RefactoringTest { } return null; } - + //-------------------------------------------------------- public void testPushDownMethodToImplicitSubclass() throws Exception { performPushDown_pass(new String[] { "TSuper", "T", "B" }, new String[] { "rm" }, new String[][] { new String[0] }, new String[] {}, "R"); } - + public void testDeclaringTypeHasADirectPhantomSubRole() throws Exception { performPushDown_fail(new String[] { "TSuper", "T1", "T2" }, new String[] { "rm" }, new String[][] { new String[0] }, new String[] {}, "R"); } - + public void testPushedDownMethodReferencedInMethodBinding1() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] { "bm" }, new String[][] { new String[0] }, new String[] {}, "B1"); } - + public void testPushedDownMethodReferencedInMethodBinding2() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] { "bm" }, new String[][] { new String[0] }, new String[] {}, "B1"); } - + public void testPushedDownMethodReferencedInMethodBinding3() throws Exception { performPushDown_fail(new String[] { "T1", "T2", "B" }, new String[] { "rm" }, new String[][] { new String[0] }, new String[] {}, "Role"); - } - + } + public void testPushedDownMethodIsReferencedInRegularGuard1() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] { "b" }, new String[][] { new String[0] }, new String[] {}, "R1"); - } - + } + public void testPushedDownMethodIsReferencedInRegularGuard2() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] { "b" }, new String[][] { new String[0] }, new String[] {}, "R1"); - } - + } + public void testPushedDownMethodIsReferencedInBaseGuard1() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] { "b" }, new String[][] { new String[0] }, new String[] {}, "B1"); } - + public void testPushedDownMethodIsReferencedInBaseGuard2() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] { "b" }, new String[][] { new String[0] }, new String[] {}, "B1"); } @@ -175,7 +175,7 @@ public class PushDownTests extends RefactoringTest { public void testPushedDownMethodIsReferencedInBaseGuard3() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] { "b" }, new String[][] { new String[0] }, new String[] {}, "B1"); } - + public void testPushedDownMethodIsReferencedInParameterMapping1() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] { "f" }, new String[][] { new String[0] }, new String[] {}, "R1"); } @@ -187,24 +187,24 @@ public class PushDownTests extends RefactoringTest { public void testPushedDownMethodIsReferencedInParameterMapping3() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] { "f" }, new String[][] { new String[0] }, new String[] {}, "R1"); } - + /* Push Down Field Tests */ public void testPushDownFieldToImplicitSubclass() throws Exception { performPushDown_pass(new String[] { "TSuper", "T", "B" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "R"); } - + public void testPushedDownFieldReferencedInCalloutToField() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "B1"); } - + public void testPushDownTypeAnchorInstance() throws Exception { performPushDown_fail(new String[] { "T1", "T2", "T3" }, new String[] {}, new String[][] { new String[0] }, new String[] { "anchor" }, "T1"); } - + public void testPushedDownFieldWouldShadowAnInheritedField() throws Exception { performPushDown_fail(new String[] { "B", "T1", "T2" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "B"); } - + public void testPushedDownFieldIsReferencedInRegularGuard1() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] {}, new String[][] { new String[0] }, new String[] { "b" }, "R1"); } @@ -224,23 +224,23 @@ public class PushDownTests extends RefactoringTest { public void testPushedDownFieldIsReferencedInBaseGuard3() throws Exception { performPushDown_fail(new String[] { "B1", "B2", "T" }, new String[] {}, new String[][] { new String[0] }, new String[] { "b" }, "B1"); } - + public void testPushedDownFieldIsReferencedInParameterMapping1() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "R1"); } - + public void testPushedDownFieldIsReferencedInParameterMapping2() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "R1"); } - + public void testOverrideImplicitInheritedMethod() throws Exception { performPushDown_fail(new String[] { "A", "T1", "T2" }, new String[] { "m" }, new String[][] { new String[0] }, new String[] {}, "A"); } - + public void testOverrideExplicitInheritedMethod() throws Exception { performPushDown_pass(new String[] { "T2", "T1", "A" }, new String[] { "m" }, new String[][] { new String[0] }, new String[] {}, "R"); } - + // See Ticket #286 public void testPushedDownFieldIsReferencedInParameterMapping3() throws Exception { performPushDown_fail(new String[] { "T", "B" }, new String[] {}, new String[][] { new String[0] }, new String[] { "f" }, "R1"); diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/AllTests.java index 8353c6e71..82992c9cc 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/AllTests.java @@ -1,20 +1,20 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2013 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -27,7 +27,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests
*/
public class AllTests
@@ -50,7 +50,7 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenamePrivateFieldTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenameTypeTests.suite()); suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.rename.RenamePackageTests.suite()); -
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodInInterfaceTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodInInterfaceTests.java index f0212821c..9ba8415fa 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodInInterfaceTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodInInterfaceTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -40,7 +40,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** * @author brcan - * + * */ public class RenameMethodInInterfaceTests extends RefactoringTest { @@ -81,7 +81,7 @@ public class RenameMethodInInterfaceTests extends RefactoringTest { performRenameRefactoring_failing(cuQNames, "m", "k", new String[0]); } - + private void performRenameRefactoring_failing( String[] cuQNames, String methodName, @@ -111,7 +111,7 @@ public class RenameMethodInInterfaceTests extends RefactoringTest { performRenamingMtoK_passing(cuQNames, true); } - + /** * Rename method m to k and update all references. */ @@ -127,10 +127,10 @@ public class RenameMethodInInterfaceTests extends RefactoringTest private void performRenameRefactoring_passing( String[] cuQNames, - String methodName, + String methodName, String newMethodName, - String[] signatures, - boolean shouldPass, + String[] signatures, + boolean shouldPass, boolean updateReferences) throws Exception { @@ -166,7 +166,7 @@ public class RenameMethodInInterfaceTests extends RefactoringTest getFileContents( getOutputTestFileName( getSimpleName(cuQNames[idx]))), cus[idx].getSource()); - } + } assertTrue("anythingToUndo", RefactoringCore.getUndoManager() .anythingToUndo()); assertTrue("! anythingToRedo", !RefactoringCore.getUndoManager() @@ -202,7 +202,7 @@ public class RenameMethodInInterfaceTests extends RefactoringTest throws Exception { ICompilationUnit[] cus = new ICompilationUnit[qualifiedNames.length]; - + for (int idx = 0; idx < qualifiedNames.length; idx++) { Assert.isNotNull(qualifiedNames[idx]); @@ -212,7 +212,7 @@ public class RenameMethodInInterfaceTests extends RefactoringTest } return cus; } - + private String getQualifier(String qualifiedName) { int dot = qualifiedName.lastIndexOf('.'); diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodTests.java index 7ab989032..45f702fa7 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameMethodTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -34,10 +34,10 @@ public class RenameMethodTests public static Test suite()
{
TestSuite suite = new TestSuite(RenameMethodTests.class.getName());
-
+
suite.addTest(RenameVirtualMethodInClassTests.suite());
suite.addTest(RenameMethodInInterfaceTests.suite());
- suite.addTest(RenamePrivateMethodTests.suite());
+ suite.addTest(RenamePrivateMethodTests.suite());
suite.addTest(RenameStaticMethodTests.suite());
return suite;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateFieldTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateFieldTests.java index 00c17f9cb..115fe4654 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateFieldTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateFieldTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -108,7 +108,7 @@ public class RenamePrivateFieldTests extends RefactoringTest String declaringTypeName, String fieldName, String newFieldName, - boolean renameGetter, + boolean renameGetter, boolean renameSetter) throws Exception { int selectionCuIndex = firstIndexOf(selectionCuName, cuNames); @@ -132,7 +132,7 @@ public class RenamePrivateFieldTests extends RefactoringTest private void performRenamingFtoG_passing( String[] cuNames, - String declaringTypeName, + String declaringTypeName, boolean updateReferences) throws Exception { performRenameRefactoring_passing( @@ -210,7 +210,7 @@ public class RenamePrivateFieldTests extends RefactoringTest assertEqualLines("invalid undo", getFileContents(createInputTestFileName(cus, idx)), cus[idx].getSource()); } - + assertTrue("! anythingToUndo", !RefactoringCore.getUndoManager() .anythingToUndo()); assertTrue("anythingToRedo", RefactoringCore.getUndoManager() @@ -242,12 +242,12 @@ public class RenamePrivateFieldTests extends RefactoringTest { performRenamingFtoG_passing(new String[]{"T"}, "T", true); } - + public void testUpdateFieldReferenceInTeamMethod() throws Exception { performRenamingFtoG_passing(new String[]{"T"}, "T", true); } - + public void testUpdateFieldReferenceInLiftingMethod() throws Exception { performRenamingFtoG_passing(new String[]{"T"}, "T", true); @@ -266,7 +266,7 @@ public class RenamePrivateFieldTests extends RefactoringTest new String[]{"T"}, "T", "number", "amount", true, false, false, false, false, false); } - + public void testUpdateTeamFieldReferenceInNestedTeam1() throws Exception { performRenameRefactoring_passing( @@ -285,7 +285,7 @@ public class RenamePrivateFieldTests extends RefactoringTest { performRenamingFtoG_passing(new String[]{"T"}, "R", true); } - + public void testUpdateFieldReferenceInRoleclass1() throws Exception { performRenameRefactoring_passing( @@ -342,7 +342,7 @@ public class RenamePrivateFieldTests extends RefactoringTest { performRenamingFtoG_passing(new String[]{"B", "T"}, "B", true); } - + //passing public void testRenameGetterAndSetter1() throws Exception { diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateMethodTests.java index 7a91fb934..e39541b04 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenamePrivateMethodTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -41,7 +41,7 @@ import org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor; * The tests in this class have been inspired by the test class * <code>RenamePrivateMethodTests</code> in the test suite *<code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse JDT. - * + * * @author brcan */ @SuppressWarnings("restriction") @@ -63,12 +63,12 @@ public class RenamePrivateMethodTests extends RefactoringTest { return new MySetup(test); } - + protected String getRefactoringPath() { return REFACTORING_PATH; } - + private RenameRefactoring createRefactoring(RenameMethodProcessor processor) { return new RenameRefactoring(processor); @@ -82,7 +82,7 @@ public class RenamePrivateMethodTests extends RefactoringTest private void performRenameRefactoring_failing( String methodName, String newMethodName, - String[] signatures) + String[] signatures) throws Exception { IType classA = getType(createCUfromTestFile(getPackageP(), "A"), "A"); @@ -93,14 +93,14 @@ public class RenamePrivateMethodTests extends RefactoringTest RefactoringStatus result= performRefactoring(refactoring); assertNotNull("precondition was supposed to fail", result); } - + private void performRenaming_passing( String cuNames[], String declaringTypeName) throws Exception { performRenamingMtoK_passing(cuNames, declaringTypeName, true); } - + private void performRenamingMtoK_passing( String cuNames[], String declaringTypeName, @@ -110,7 +110,7 @@ public class RenamePrivateMethodTests extends RefactoringTest performRenameRefactoring_passing( cuNames, declaringTypeName, "m", "k", new String[0], updateReferences); } - + private void performRenameRefactoring_passing( String[] cuNames, String declaringTypeName, @@ -133,7 +133,7 @@ public class RenamePrivateMethodTests extends RefactoringTest assertEqualLines("invalid renaming!", getFileContents(createOutputTestFileName(cus, idx)), cus[idx].getSource()); } - + assertTrue("anythingToUndo", RefactoringCore.getUndoManager() .anythingToUndo()); assertTrue("! anythingToRedo", !RefactoringCore.getUndoManager() @@ -146,7 +146,7 @@ public class RenamePrivateMethodTests extends RefactoringTest assertEqualLines("invalid undo", getFileContents(createInputTestFileName(cus, idx)), cus[idx].getSource()); } - + assertTrue("! anythingToUndo", !RefactoringCore.getUndoManager() .anythingToUndo()); assertTrue("anythingToRedo", RefactoringCore.getUndoManager() @@ -162,18 +162,18 @@ public class RenamePrivateMethodTests extends RefactoringTest } /******* tests ******************/ - + public void testUpdateReferenceInCalloutBinding1() throws Exception { performRenaming_passing(new String[]{"B", "T"}, "B"); - } - + } + public void testUpdateReferenceInCalloutBinding2() throws Exception { performRenameRefactoring_passing( new String[]{"B", "T"}, "B", "getAmount", "getQuantity", null, true); } - + public void testUpdateReferenceInCallinBinding1() throws Exception { performRenaming_passing(new String[]{"B", "T"}, "B"); @@ -189,12 +189,12 @@ public class RenamePrivateMethodTests extends RefactoringTest { performRenaming_passing(new String[]{"T"}, "T"); } - + public void testUpdatePrivateTeamMethodInvocation1() throws Exception { performRenaming_passing(new String[]{"T"}, "T"); } - + public void testUpdatePrivateTeamMethodInvocation2() throws Exception { performRenameRefactoring_passing(new String[]{"T", "B1"}, "T", "m1", "k1", null, true); diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameStaticMethodTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameStaticMethodTests.java index e44d775f0..fdab6ee0c 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameStaticMethodTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameStaticMethodTests.java @@ -35,8 +35,8 @@ import org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethod /** * The tests in this class have initially been copied from the original class * <code>RenameStaticMethodTests</code> in the test suite - *<code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse. - * + *<code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse. + * * @author brcan */ @SuppressWarnings("restriction") @@ -214,81 +214,81 @@ public class RenameStaticMethodTests extends RefactoringTest // { // helper0_passing(); // } - + public void testFail0() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail1() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail2() throws Exception{ performRenamingMtoK_failing(); } - + //testFail3 deleted - + public void testFail4() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail5() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail6() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail7() throws Exception{ performRenamingMtoK_failing(); } - + public void testFail8() throws Exception{ performRenamingMtoK_failing(); } - + public void test0() throws Exception{ performRenaming_passing(); } - + public void test1() throws Exception{ performRenaming_passing(); } - + public void test2() throws Exception{ performRenaming_passing(); } - + public void test3() throws Exception{ performRenaming_passing(); } - + public void test4() throws Exception{ performRenaming_passing(); } - + public void test5() throws Exception{ performRenaming_passing(); } - + public void test6() throws Exception{ performRenaming_passing(); } - + public void test7() throws Exception{ performRenameRefactoring_passing2("m", "k", new String[]{Signature.SIG_INT}); } - + public void test8() throws Exception{ performRenameRefactoring_passing2("m", "k", new String[]{Signature.SIG_INT}); } - + public void test9() throws Exception{ performRenameRefactoring_passing1("m", "k", new String[]{Signature.SIG_INT}, false); } - + public void test10() throws Exception { ICompilationUnit cuA = createCUfromTestFile(getPackageP(), "A"); @@ -317,7 +317,7 @@ public class RenameStaticMethodTests extends RefactoringTest { ICompilationUnit cuA = createCUfromTestFile(packageA, "A"); ICompilationUnit cuB = createCUfromTestFile(packageB, "B"); - + IType classA = getType(cuA, "A"); RenameMethodProcessor processor = createProcessor(classA.getMethod("method2", new String[0])); @@ -336,7 +336,7 @@ public class RenameStaticMethodTests extends RefactoringTest packageB.delete(true, new NullProgressMonitor()); } } - + public void testUpdateReferenceToBaseMethodInCalloutBinding1() throws Exception { performRenameRefactoring_passing(new String[] { "B", "T" }, "B", "getAmount", "getQuantity", new String[0], true, true); } 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 10b9c41ad..c62c822d6 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 @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -43,26 +43,26 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; * FIXME(SH): * Once this test class is reactivated, also check the following conditions which are * known not to work currently (e.g., OTDT 1.1.6): - * + Rename role type: - * - inline (not dialog-based) refactoring links all references of a role type but not: - * - its declaration - * - class literals + * + Rename role type: + * - inline (not dialog-based) refactoring links all references of a role type but not: + * - its declaration + * - class literals * (linked-mode in the Editor). * - class literals in a predicate are not renamed - * + * * @author brcan - * + * */ @SuppressWarnings({"restriction", "nls"}) public class RenameTypeTests extends RefactoringTest { private static final String REFACTORING_PATH = "RenameType/"; - + private static IPackageFragment _teamPkg; - + private RenameProcessor _processor = null; - + public RenameTypeTests(String name) { super(name); @@ -98,7 +98,7 @@ public class RenameTypeTests extends RefactoringTest { _teamPkg = getRoot().createPackageFragment("p.T1", true, null); } - + private IPackageFragment getUpdatedTeamPackageFragment() throws Exception { return getRoot().getPackageFragment("p.T2"); @@ -199,7 +199,7 @@ public class RenameTypeTests extends RefactoringTest { if (cus[idx].getElementName().startsWith("R") || cus[idx].getElementName().startsWith("TR")) - + { cus[idx] = updatedTeamPackage.getCompilationUnit(cus[idx].getElementName()); assertEqualLines("invalid renaming!", @@ -218,7 +218,7 @@ public class RenameTypeTests extends RefactoringTest } } - + protected ICompilationUnit[] createCUs(String[] cuNames) throws Exception { ICompilationUnit[] cus = new ICompilationUnit[cuNames.length]; @@ -237,7 +237,7 @@ public class RenameTypeTests extends RefactoringTest } return cus; } - + /*********** tests ***********/ //passing public void testRenameTeamclass() throws Exception { @@ -407,11 +407,11 @@ public class RenameTypeTests extends RefactoringTest public void testShadowedNameOfSubType1() throws Exception { performRenameRefactoring_failing(new String[] { "T1", "T2" }, "R1", "R2", false); } - + public void testNameClashWithRoleFile() throws Exception { performRenameRefactoring_failing(new String[] { "T1", "R2" }, "R1", "R2", true); } - + public void testShadowedNameRoleFile1() throws Exception { performRenameRefactoring_failing(new String[] { "R1", "T1" }, "R1", "R2", true); } @@ -431,7 +431,7 @@ public class RenameTypeTests extends RefactoringTest public void testShadowedNameRoleFile6() throws Exception { performRenameRefactoring_failing(new String[] { "T2", "T1", "R2" }, "R1", "R2", true); } - + public void testImplicitOverridingWithRoleFile1() throws Exception { performRenameRefactoring_failing(new String[] { "T2", "T1", "R1" }, "R", "R1", true); } @@ -439,9 +439,9 @@ public class RenameTypeTests extends RefactoringTest public void testImplicitOverridingWithRoleFile2() throws Exception { performRenameRefactoring_failing(new String[] { "T", "R1", "T1" }, "R", "R1", true); } - + // failing - + // FIXME(jogeb): phantom roles within phantom roles wont be found by the // OTTypeHierarchy or change strategy in RenameTypeAdapter public void _testShadowedNameOfSubType2() throws Exception { @@ -451,7 +451,7 @@ 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); @@ -465,11 +465,11 @@ public class RenameTypeTests extends RefactoringTest 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(); } diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameVirtualMethodInClassTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameVirtualMethodInClassTests.java index d3782df7d..cde037e32 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameVirtualMethodInClassTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rename/RenameVirtualMethodInClassTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -43,7 +43,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest; /** * @author brcan - * + * */ @SuppressWarnings("restriction") public class RenameVirtualMethodInClassTests extends RefactoringTest { diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/AllTests.java index b9886b09c..5d562c5e2 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -28,7 +28,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse refactoring tests
*/
public class AllTests
@@ -49,7 +49,7 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.OTDeleteTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.PasteActionTest.suite());
suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.reorg.OTPasteActionTest.suite());
-
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/MockReorgQueries.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/MockReorgQueries.java index 6ffbade89..abc4fe14f 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/MockReorgQueries.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/MockReorgQueries.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTCopyToClipboardTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTCopyToClipboardTests.java index 5dc42c99d..c20a81ade 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTCopyToClipboardTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTCopyToClipboardTests.java @@ -6,7 +6,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/
@@ -67,7 +67,7 @@ public class OTCopyToClipboardTests extends RefactoringTest private Clipboard _clipboard;
private ICompilationUnit _cuT1;
private ICompilationUnit _cuB1;
-
+
public OTCopyToClipboardTests(String name) {
super(name);
}
@@ -80,8 +80,8 @@ public class OTCopyToClipboardTests extends RefactoringTest {
super.setUp();
_clipboard = new MockClipboard(Display.getDefault());
-
- _cuT1 = createCU(getPackageP(), CU_T1_NAME + ".java",
+
+ _cuT1 = createCU(getPackageP(), CU_T1_NAME + ".java",
"package p;" + "\n" +
"import java.util.List;" + "\n" +
"public team class T1" + "\n" +
@@ -101,7 +101,7 @@ public class OTCopyToClipboardTests extends RefactoringTest "}" + "\n" +
"}");
- _cuB1 = createCU(getPackageP(), CU_B1_NAME + ".java",
+ _cuB1 = createCU(getPackageP(), CU_B1_NAME + ".java",
"package p;" + "\n" +
"public class B1" + "\n" +
"{" + "\n" +
@@ -110,14 +110,14 @@ public class OTCopyToClipboardTests extends RefactoringTest "}");
_labelProvider = new JavaElementLabelProvider(
- JavaElementLabelProvider.SHOW_VARIABLE +
- JavaElementLabelProvider.SHOW_PARAMETERS +
+ JavaElementLabelProvider.SHOW_VARIABLE +
+ JavaElementLabelProvider.SHOW_PARAMETERS +
JavaElementLabelProvider.SHOW_TYPE);
assertTrue("T1.java does not exist", _cuT1.exists());
assertTrue("B1.java does not exist", _cuB1.exists());
}
-
+
protected void tearDown() throws Exception
{
super.tearDown();
@@ -126,17 +126,17 @@ public class OTCopyToClipboardTests extends RefactoringTest _labelProvider.dispose();
delete(_cuT1);
delete(_cuB1);
- }
-
+ }
+
private static void delete(ISourceManipulation element) {
try {
if (element != null && ((IJavaElement)element).exists())
element.delete(true, null);
} catch(JavaModelException e) {
//ignore, we must keep going
- }
+ }
}
-
+
private void checkDisabled(Object[] elements){
CopyToClipboardAction copyAction= new CopyToClipboardAction(new MockWorkbenchSite(elements), _clipboard);
copyAction.setAutoRepeatOnFailure(true);
@@ -157,10 +157,10 @@ public class OTCopyToClipboardTests extends RefactoringTest IResource[] resourcesCopied= getResources(elementsCopied);
IJavaElement[] javaElementsCopied= getJavaElements(elementsCopied);
IType[] mainTypesCopied= ReorgUtils.getMainTypes(javaElementsCopied);
-
+
IResource[] resourcesExpected= computeResourcesExpectedInClipboard(resourcesCopied, mainTypesCopied, javaElementsCopied);
IJavaElement[] javaElementsExpected= computeJavaElementsExpectedInClipboard(javaElementsCopied, mainTypesCopied);
-
+
String[] clipboardFiles= getClipboardFiles();
IResource[] clipboardResources= getClipboardResources();
String clipboardText= getClipboardText();
@@ -173,10 +173,10 @@ public class OTCopyToClipboardTests extends RefactoringTest checkElements(resourcesExpected, clipboardResources);
checkElements(javaElementsExpected, clipboardJavaElements);
}
-
+
private void checkTypedSources(IJavaElement[] javaElementsCopied, TypedSource[] clipboardTypedSources) throws Exception {
TypedSource[] typedSources= TypedSource.createTypedSources(javaElementsCopied);
- assertEquals("different number", typedSources.length, clipboardTypedSources.length);
+ assertEquals("different number", typedSources.length, clipboardTypedSources.length);
TypedSource.sortByType(typedSources);
TypedSource.sortByType(clipboardTypedSources);
for (int i= 0; i < typedSources.length; i++) {
@@ -247,17 +247,17 @@ public class OTCopyToClipboardTests extends RefactoringTest IJavaElement element= javaElementsCopied[i];
if (! ReorgUtils.isInsideCompilationUnit(element)){
String name= getName(element);
- assertTrue("name not in set:" + name, stringLines.contains(name));
+ assertTrue("name not in set:" + name, stringLines.contains(name));
}
}
- }
-
+ }
+
private static void checkFiles(IResource[] resourcesCopied, IJavaElement[] javaElementsCopied, IType[] mainTypes, String[] clipboardFiles) {
int expected= 0;
expected += resourcesCopied.length;
expected += countResources(javaElementsCopied);
expected += mainTypes.length;
-
+
//we cannot compare file names here because they're absolute and depend on the worspace location
assertEquals("different number of files in clipboard", expected, clipboardFiles.length);
}
@@ -293,49 +293,49 @@ public class OTCopyToClipboardTests extends RefactoringTest private IJavaElement[] getClipboardJavaElements() {
IJavaElement[] elements= (IJavaElement[])_clipboard.getContents(JavaElementTransfer.getInstance());
- return elements == null ? new IJavaElement[0]: elements;
+ return elements == null ? new IJavaElement[0]: elements;
}
private String[] getClipboardFiles() {
String[] files= (String[])_clipboard.getContents(FileTransfer.getInstance());
return files == null ? new String[0]: files;
}
-
+
private IResource[] getClipboardResources() {
IResource[] resources= (IResource[])_clipboard.getContents(ResourceTransfer.getInstance());
- return resources == null ? new IResource[0]: resources;
+ return resources == null ? new IResource[0]: resources;
}
private TypedSource[] getClipboardTypedSources() {
TypedSource[] typedSources= (TypedSource[])_clipboard.getContents(TypedSourceTransfer.getInstance());
- return typedSources == null ? new TypedSource[0]: typedSources;
+ return typedSources == null ? new TypedSource[0]: typedSources;
}
private String getClipboardText() {
return (String)_clipboard.getContents(TextTransfer.getInstance());
}
-
+
///---------tests
public void testDisabled0() {
Object[] elements= {};
checkDisabled(elements);
- }
+ }
public void testDisabled1() throws Exception {
Object[] elements= {null};
checkDisabled(elements);
- }
+ }
public void testDisabled2() throws Exception {
Object[] elements= {this};
checkDisabled(elements);
- }
+ }
public void testDisabled3() throws Exception {
Object[] elements= {RefactoringTestSetup.getProject(), getPackageP()};
checkDisabled(elements);
- }
+ }
public void testDisabled4() throws Exception{
checkDisabled(new Object[]{getPackageP(), _cuT1});
@@ -354,25 +354,25 @@ public class OTCopyToClipboardTests extends RefactoringTest Object classA= _cuT1.getType("T1");
Object[] elements= {fieldF, classA};
checkDisabled(elements);
- }
+ }
public void testDisabled16() throws Exception {
Object fieldF= _cuT1.getType("T1").getField("x");
Object[] elements= {fieldF, _cuT1};
checkDisabled(elements);
- }
+ }
public void testDisabled20() throws Exception {
Object fieldF= _cuT1.getType("T1").getField("x");
Object[] elements= {fieldF, getRoot()};
checkDisabled(elements);
- }
+ }
public void testDisabled21() throws Exception {
Object fieldF= _cuT1.getType("T1").getField("x");
Object[] elements= {fieldF, RefactoringTestSetup.getProject()};
checkDisabled(elements);
- }
+ }
public void testDisabled22() throws Exception {
Object typeT1= _cuT1.getType("T1");
@@ -380,27 +380,27 @@ public class OTCopyToClipboardTests extends RefactoringTest Object[] elements= {typeT1, typeB1};
checkDisabled(elements);
}
-
+
public void testEnabled0() throws Exception {
Object[] elements= {RefactoringTestSetup.getProject()};
checkEnabled(elements);
- }
+ }
public void testEnabled1() throws Exception {
Object[] elements= {getPackageP()};
checkEnabled(elements);
- }
+ }
public void testEnabled2() throws Exception {
Object[] elements= {getRoot()};
checkEnabled(elements);
- }
+ }
public void testEnabled3() throws Exception {
Object[] elements= {RefactoringTestSetup.getDefaultSourceFolder()};
checkEnabled(elements);
}
-
+
public void testEnabled5() throws Exception{
checkEnabled(new Object[]{getRoot()});
}
@@ -412,11 +412,11 @@ public class OTCopyToClipboardTests extends RefactoringTest public void testEnabled7() throws Exception{
checkEnabled(new Object[]{getRoot().getJavaProject()});
}
-
+
public void testEnabled8() throws Exception{
checkEnabled(new Object[]{getPackageP()});
}
-
+
public void testEnabled10() throws Exception{
Object packDecl= _cuT1.getPackageDeclarations()[0];
Object[] elements= {packDecl};
@@ -475,7 +475,7 @@ public class OTCopyToClipboardTests extends RefactoringTest Object[] elements= {classA, packDecl};
checkEnabled(elements);
}
-
+
public void testEnabledOT0() throws Exception
{
IType teamT1 = _cuT1.getType("T1");
@@ -493,7 +493,7 @@ public class OTCopyToClipboardTests extends RefactoringTest if (elem instanceof IType)
{
IType type = (IType)elem;
- IRoleType roleR1 = (IRoleType)OTModelManager.getOTElement(type);
+ IRoleType roleR1 = (IRoleType)OTModelManager.getOTElement(type);
Object[] elements = { roleR1 };
checkEnabled(elements);
}
@@ -538,7 +538,7 @@ public class OTCopyToClipboardTests extends RefactoringTest IMethodMapping[] mapping = roleR1.getMethodMappings(IRoleType.CALLINS);
ICallinMapping callin = (ICallinMapping)mapping[0];
Object[] elements = { callin };
- checkEnabled(elements);
+ checkEnabled(elements);
}
public void testEnabledOT5() throws Exception
@@ -557,7 +557,7 @@ public class OTCopyToClipboardTests extends RefactoringTest }
}
Object[] elements = { calloutToField };
- checkEnabled(elements);
+ checkEnabled(elements);
}
public void testEnabledOT6() throws Exception
@@ -569,7 +569,7 @@ public class OTCopyToClipboardTests extends RefactoringTest Object[] elements = { fieldX, methodT1m, nestedTeamTR1 };
checkEnabled(elements);
}
-
-
+
+
}
//sko}
\ No newline at end of file diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTDeleteTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTDeleteTests.java index 2013d16e5..3a084f1c9 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTDeleteTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTDeleteTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -126,7 +126,7 @@ public class OTDeleteTests extends RefactoringTest return new MockReorgQueries();
}
- //---- tests ----
+ //---- tests ----
public void testDeleteTeamclass() throws Exception
{
// ParticipantTesting.reset();
@@ -135,9 +135,9 @@ public class OTDeleteTests extends RefactoringTest IJavaElement[] elems = new IJavaElement[] { aTeam };
checkDelete(elems, true);
// String[] handles = ParticipantTesting.createHandles(elem0);
-// ParticipantTesting.testDelete(handles);
+// ParticipantTesting.testDelete(handles);
}
-
+
public void testDeleteNestedTeamclass() throws Exception
{
loadFileSetup();
@@ -150,7 +150,7 @@ public class OTDeleteTests extends RefactoringTest {
loadFileSetup();
IType type = _cuT.getType("T").getType("R");
- IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
+ IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
IJavaElement[] elems = new IJavaElement[] { role };
checkDelete(elems, false);
}
@@ -160,7 +160,7 @@ public class OTDeleteTests extends RefactoringTest {
loadFileSetup();
IType type = _cuT.getType("T").getType("R");
- IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
+ IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
String message1= ReorgUtils.getName(role);
assertEquals("role 'R'", message1);
}
@@ -169,8 +169,8 @@ public class OTDeleteTests extends RefactoringTest {
loadFileSetup();
IType type = _cuT.getType("T").getType("R");
- IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
- IMethodMapping[] mappings = role.getMethodMappings();
+ IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
+ IMethodMapping[] mappings = role.getMethodMappings();
IJavaElement[] elems = new IJavaElement[] { mappings[0] };
checkDelete(elems, false);
}
@@ -179,8 +179,8 @@ public class OTDeleteTests extends RefactoringTest {
loadFileSetup();
IType type = _cuT.getType("T").getType("R");
- IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
- IMethodMapping[] mappings = role.getMethodMappings();
+ IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
+ IMethodMapping[] mappings = role.getMethodMappings();
IJavaElement[] elems = new IJavaElement[] { mappings[0] };
checkDelete(elems, false);
}
@@ -189,8 +189,8 @@ public class OTDeleteTests extends RefactoringTest {
loadFileSetup();
IType type = _cuT.getType("T").getType("R");
- IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
- IMethodMapping[] mappings = role.getMethodMappings();
+ IRoleType role = (IRoleType)OTModelManager.getOTElement(type);
+ IMethodMapping[] mappings = role.getMethodMappings();
IJavaElement[] elems = new IJavaElement[] { mappings[0] };
checkDelete(elems, false);
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTPasteActionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTPasteActionTest.java index 9918adb24..29edb080f 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTPasteActionTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/OTPasteActionTest.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -62,7 +62,7 @@ public class OTPasteActionTest extends RefactoringTest public OTPasteActionTest(String name) {
super(name);
}
-
+
public static Test suite() {
return new MySetup(new TestSuite(OTPasteActionTest.class));
}
@@ -76,8 +76,8 @@ public class OTPasteActionTest extends RefactoringTest _clipboard= new MockClipboard(Display.getDefault());
_packageQ = MySetup.getDefaultSourceFolder().createPackageFragment("q", true, null);
}
-
- protected void tearDown() throws Exception
+
+ protected void tearDown() throws Exception
{
if (_packageQ.exists())
{
@@ -93,7 +93,7 @@ public class OTPasteActionTest extends RefactoringTest elements.addAll(Arrays.asList(array2));
return elements.toArray();
}
-
+
private PasteAction verifyEnabled(IResource[] copySelectedResources, IJavaElement[] copySelectedJavaElements, IResource[] pasteSelectedResources, IJavaElement[] pasteSelectedJavaElements) throws JavaModelException {
PasteAction pasteAction= new PasteAction(new MockWorkbenchSite(merge(pasteSelectedResources, pasteSelectedJavaElements)), _clipboard);
CopyToClipboardAction copyToClipboardAction= new CopyToClipboardAction(new MockWorkbenchSite(merge(copySelectedResources, copySelectedJavaElements)), _clipboard);
@@ -101,7 +101,7 @@ public class OTPasteActionTest extends RefactoringTest copyToClipboardAction.update(copyToClipboardAction.getSelection());
assertTrue("copy not enabled", copyToClipboardAction.isEnabled());
copyToClipboardAction.run();
-
+
pasteAction.update(pasteAction.getSelection());
assertTrue("paste should be enabled", pasteAction.isEnabled());
return pasteAction;
@@ -110,7 +110,7 @@ public class OTPasteActionTest extends RefactoringTest private void compareContents(String cuName) throws JavaModelException, IOException {
assertEqualLines(cuName, getFileContents(getOutputTestFileName(cuName)), getPackageP().getCompilationUnit(cuName + ".java").getSource());
}
-
+
private void delete(ICompilationUnit cu) throws Exception {
try {
performDummySearch();
@@ -132,7 +132,7 @@ public class OTPasteActionTest extends RefactoringTest {
IType teamTSource = cuTSource.getType("TSource");
IType teamTDest = cuTDest.getType("TDest");
-
+
assertTrue("TSource does not exist", teamTSource.exists());
assertTrue("TDest does not exist", teamTDest.exists());
@@ -143,7 +143,7 @@ public class OTPasteActionTest extends RefactoringTest PasteAction paste = verifyEnabled(copyResources,
copyJavaElements, pasteResources, pasteJavaElements);
paste.run((IStructuredSelection)paste.getSelection());
-
+
compareContents("TSource");
compareContents("TDest");
}
@@ -152,7 +152,7 @@ public class OTPasteActionTest extends RefactoringTest delete(cuTSource);
}
}
-
+
public void testPasteNestedTeamclass() throws Exception
{
ICompilationUnit cuTSource = createCUfromTestFile(getPackageP(),
@@ -219,16 +219,16 @@ public class OTPasteActionTest extends RefactoringTest {
ICompilationUnit cuTSource= createCUfromTestFile(getPackageP(), "TSource");
ICompilationUnit cuTDest= createCUfromTestFile(getPackageP(), "TDest");
-
- try
+
+ try
{
IRoleType roleSrc = (IRoleType)OTModelManager.getOTElement(cuTSource.getType("TSource").getType("R"));
IMethodMapping calloutMapping = roleSrc.getMethodMappings()[0];
IType roleTDest_R = cuTDest.getType("TDest").getType("R");
-
+
assertTrue("callout does not exist", calloutMapping.exists());
assertTrue("R does not exist", roleTDest_R.exists());
-
+
IJavaElement[] copyJavaElements= {calloutMapping};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {roleTDest_R};
@@ -237,7 +237,7 @@ public class OTPasteActionTest extends RefactoringTest paste.run((IStructuredSelection)paste.getSelection());
compareContents("TSource");
compareContents("TDest");
- }
+ }
finally
{
delete(cuTSource);
@@ -249,16 +249,16 @@ public class OTPasteActionTest extends RefactoringTest {
ICompilationUnit cuTSource= createCUfromTestFile(getPackageP(), "TSource");
ICompilationUnit cuTDest= createCUfromTestFile(getPackageP(), "TDest");
-
- try
+
+ try
{
IRoleType roleSrc = (IRoleType)OTModelManager.getOTElement(cuTSource.getType("TSource").getType("R"));
IMethodMapping calloutMapping = roleSrc.getMethodMappings()[0];
IType roleTDest_R = cuTDest.getType("TDest").getType("R");
-
+
assertTrue("callout does not exist", calloutMapping.exists());
assertTrue("R does not exist", roleTDest_R.exists());
-
+
IJavaElement[] copyJavaElements= {calloutMapping};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {roleTDest_R};
@@ -267,7 +267,7 @@ public class OTPasteActionTest extends RefactoringTest paste.run((IStructuredSelection)paste.getSelection());
compareContents("TSource");
compareContents("TDest");
- }
+ }
finally
{
delete(cuTSource);
@@ -279,16 +279,16 @@ public class OTPasteActionTest extends RefactoringTest {
ICompilationUnit cuTSource= createCUfromTestFile(getPackageP(), "TSource");
ICompilationUnit cuTDest= createCUfromTestFile(getPackageP(), "TDest");
-
- try
+
+ try
{
IRoleType roleSrc = (IRoleType)OTModelManager.getOTElement(cuTSource.getType("TSource").getType("R"));
IMethodMapping calloutMapping = roleSrc.getMethodMappings()[0];
IType roleTDest_R = cuTDest.getType("TDest").getType("R");
-
+
assertTrue("callout does not exist", calloutMapping.exists());
assertTrue("R does not exist", roleTDest_R.exists());
-
+
IJavaElement[] copyJavaElements= {calloutMapping};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {roleTDest_R};
@@ -297,7 +297,7 @@ public class OTPasteActionTest extends RefactoringTest paste.run((IStructuredSelection)paste.getSelection());
compareContents("TSource");
compareContents("TDest");
- }
+ }
finally
{
delete(cuTSource);
@@ -337,7 +337,7 @@ public class OTPasteActionTest extends RefactoringTest delete(cuTDest);
}
}
-
+
public void testPasteCallinMapping() throws Exception
{
ICompilationUnit cuTSource = createCUfromTestFile(getPackageP(),
@@ -370,5 +370,5 @@ public class OTPasteActionTest extends RefactoringTest delete(cuTDest);
}
}
-
+
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/PasteActionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/PasteActionTest.java index 97f940f02..634945106 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/PasteActionTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/reorg/PasteActionTest.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -68,7 +68,7 @@ public class PasteActionTest extends RefactoringTest{ public PasteActionTest(String name) {
super(name);
}
-
+
public static Test suite() {
return new RefactoringTestSetup(new TestSuite(PasteActionTest.class));
}
@@ -92,7 +92,7 @@ public class PasteActionTest extends RefactoringTest{ elements.addAll(Arrays.asList(array2));
return elements.toArray();
}
-
+
private PasteAction verifyEnabled(IResource[] copySelectedResources, IJavaElement[] copySelectedJavaElements, IResource[] pasteSelectedResources, IJavaElement[] pasteSelectedJavaElements) throws JavaModelException {
PasteAction pasteAction= new PasteAction(new MockWorkbenchSite(merge(pasteSelectedResources, pasteSelectedJavaElements)), _clipboard);
CopyToClipboardAction copyToClipboardAction= new CopyToClipboardAction(new MockWorkbenchSite(merge(copySelectedResources, copySelectedJavaElements)), _clipboard);
@@ -100,7 +100,7 @@ public class PasteActionTest extends RefactoringTest{ copyToClipboardAction.update(copyToClipboardAction.getSelection());
assertTrue("copy not enabled", copyToClipboardAction.isEnabled());
copyToClipboardAction.run();
-
+
pasteAction.update(pasteAction.getSelection());
assertTrue("paste should be enabled", pasteAction.isEnabled());
return pasteAction;
@@ -113,7 +113,7 @@ public class PasteActionTest extends RefactoringTest{ copyToClipboardAction.update(copyToClipboardAction.getSelection());
assertTrue("copy not enabled", copyToClipboardAction.isEnabled());
copyToClipboardAction.run();
-
+
pasteAction.update(pasteAction.getSelection());
assertTrue("paste should be enabled", pasteAction.isEnabled());
return pasteAction;
@@ -130,7 +130,7 @@ public class PasteActionTest extends RefactoringTest{ IResource[] resources= {RefactoringTestSetup.getProject().getProject()};
verifyEnabled(resources, javaElements, new IResource[0], new IJavaElement[0]);
}
-
+
public void testEnabled_workingSet() throws Exception {
IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test", new IAdaptable[] {});
try {
@@ -143,7 +143,7 @@ public class PasteActionTest extends RefactoringTest{ private void compareContents(String cuName) throws JavaModelException, IOException {
assertEqualLines(cuName, getFileContents(getOutputTestFileName(cuName)), getPackageP().getCompilationUnit(cuName + ".java").getSource());
}
-
+
private void delete(ICompilationUnit cu) throws Exception {
try {
performDummySearch();
@@ -162,14 +162,14 @@ public class PasteActionTest extends RefactoringTest{ ICompilationUnit cuA= createCUfromTestFile(getPackageP(), "A");
ICompilationUnit cuB= createCUfromTestFile(getPackageP(), "B");
-
+
try {
IType typeA= cuA.getType("A");
IType typeB= cuB.getType("B");
-
+
assertTrue("A does not exist", typeA.exists());
assertTrue("B does not exist", typeB.exists());
-
+
IJavaElement[] copyJavaElements= {typeA};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {typeB};
@@ -187,14 +187,14 @@ public class PasteActionTest extends RefactoringTest{ public void test2() throws Exception{
ICompilationUnit cuA= createCUfromTestFile(getPackageP(), "A");
ICompilationUnit cuB= createCUfromTestFile(getPackageP(), "B");
-
+
try {
IField fieldY= cuA.getType("A").getField("y");
IType typeB= cuB.getType("B");
-
+
assertTrue("y does not exist", fieldY.exists());
assertTrue("B does not exist", typeB.exists());
-
+
IJavaElement[] copyJavaElements= {fieldY};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {typeB};
@@ -213,14 +213,14 @@ public class PasteActionTest extends RefactoringTest{ // printTestDisabledMessage("test for bug#19007");
ICompilationUnit cuA= createCUfromTestFile(getPackageP(), "A");
ICompilationUnit cuB= createCUfromTestFile(getPackageP(), "B");
-
+
try {
IJavaElement elem0= cuA.getImport("java.lang.*");
IImportContainer importContainer= cuB.getImportContainer();
-
+
assertTrue("y does not exist", elem0.exists());
assertTrue("B does not exist", importContainer.exists());
-
+
IJavaElement[] copyJavaElements= {elem0};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {importContainer};
@@ -241,10 +241,10 @@ public class PasteActionTest extends RefactoringTest{ try {
IJavaElement elem0= cuA.getType("A").getMethod("f", new String[0]);
IMethod method= cuA.getType("A").getMethod("f1", new String[0]);
-
+
assertTrue("y does not exist", elem0.exists());
assertTrue("B does not exist", method.exists());
-
+
IJavaElement[] copyJavaElements= {elem0};
IResource[] copyResources= {};
IJavaElement[] pasteJavaElements= {method};
@@ -256,7 +256,7 @@ public class PasteActionTest extends RefactoringTest{ delete(cuA);
}
}
-
+
public void testPastingJavaElementIntoWorkingSet() throws Exception {
IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test", new IAdaptable[] {});
try {
@@ -304,7 +304,7 @@ public class PasteActionTest extends RefactoringTest{ }
public void testPastingExistingElementIntoWorkingSet() throws Exception {
- IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
+ IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
new IAdaptable[] {RefactoringTestSetup.getProject()});
try {
IResource[] resources= {};
@@ -319,7 +319,7 @@ public class PasteActionTest extends RefactoringTest{ }
public void testPastingChildJavaElementIntoWorkingSet() throws Exception {
- IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
+ IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
new IAdaptable[] {RefactoringTestSetup.getProject()});
try {
IResource[] resources= {};
@@ -336,7 +336,7 @@ public class PasteActionTest extends RefactoringTest{ public void testPastingChildResourceIntoWorkingSet() throws Exception {
IFolder folder= RefactoringTestSetup.getProject().getProject().getFolder("folder");
folder.create(true, true, null);
- IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
+ IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
new IAdaptable[] {folder});
IFolder sub= folder.getFolder("sub");
sub.create(true, true, null);
@@ -356,7 +356,7 @@ public class PasteActionTest extends RefactoringTest{ }
public void testPastingChildResourceIntoWorkingSetContainingParent() throws Exception {
- IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
+ IWorkingSet ws= PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet("Test",
new IAdaptable[] {RefactoringTestSetup.getProject()});
IFolder folder= RefactoringTestSetup.getProject().getProject().getFolder("folder");
folder.create(true, true, null);
@@ -384,7 +384,7 @@ public class PasteActionTest extends RefactoringTest{ setClipboardContents(typedSources, repeat+1);
}
}
-
+
private void copyAndPasteTypedSources(IJavaElement[] elemsForClipboard, IJavaElement[] pasteSelectedJavaElements, boolean pasteEnabled) throws CoreException {
setClipboardContents(TypedSource.createTypedSources(elemsForClipboard), 0);
PasteAction pasteAction= new PasteAction(new MockWorkbenchSite(pasteSelectedJavaElements), _clipboard);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/requiredfeatures/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/requiredfeatures/AllTests.java index b06d437ae..11e024538 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/requiredfeatures/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/requiredfeatures/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -27,7 +27,7 @@ import junit.framework.TestSuite; /**
* @author svacina
- *
+ *
* Runs all test cases which are needed for refactoring
*/
public class AllTests
@@ -42,9 +42,9 @@ public class AllTests {
TestSuite suite = new TestSuite(
"Tests for required features");
-
+
//TODO(jsv) test only the usage of specific components used in Refactoring Processor
-
+
// Hierarchy
suite.addTest(org.eclipse.objectteams.otdt.tests.superhierarchy.AllTests.suite());
// TypeHelper.getInheritedMethods
@@ -52,7 +52,7 @@ public class AllTests // SearchEngine
suite.addTest(org.eclipse.objectteams.otdt.tests.search.OTJavaMethodSearchTests.suite());
suite.addTest(org.eclipse.objectteams.otdt.tests.search.OTJavaTypeSearchTests.suite());
- //TODO(jsv): add required selection tests
+ //TODO(jsv): add required selection tests
return suite;
}
}
\ No newline at end of file diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rolefile/MoveToRileFileTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rolefile/MoveToRileFileTests.java index 3cabd15fd..35d95a8eb 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rolefile/MoveToRileFileTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/rolefile/MoveToRileFileTests.java @@ -1,17 +1,17 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2010 (c) GK Software AG - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Stephan Herrmann - Initial API and implementation **********************************************************************/ @@ -90,7 +90,7 @@ public class MoveToRileFileTests extends RefactoringTest { MoveToRoleFileRefactoring ref = createMoveToRoleFileRefactoring(roleType); assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); - + RefactoringStatus checkInputResult = ref.checkFinalConditions(new NullProgressMonitor()); assertTrue("precondition was supposed to pass", !checkInputResult.hasError()); performChange(ref, false); @@ -109,7 +109,7 @@ public class MoveToRileFileTests extends RefactoringTest { } } } - + private void performMoveToRoleFile_initialChecksFailing(String inputCU, String roleName, String expectedMsg) throws Exception { ICompilationUnit cu = createCUfromTestFile(getPackageP(), inputCU); try { @@ -147,7 +147,7 @@ public class MoveToRileFileTests extends RefactoringTest { // MoveToRoleFileRefactoring ref = createMoveToRoleFileRefactoring(roleType); // // assertTrue("activation", ref.checkInitialConditions(new NullProgressMonitor()).isOK()); -// +// // RefactoringStatus result = ref.checkFinalConditions(new NullProgressMonitor()); // assertNotNull("precondition was supposed to fail.", result); // assertTrue("precondition was supposed to fail.", !result.isOK()); @@ -167,15 +167,15 @@ public class MoveToRileFileTests extends RefactoringTest { /******* tests ******************/ /* Move To Role File Tests */ - + public void testSimpleRole1() throws Exception { performMoveToRoleFile_pass("T", "R", new String[] { "T", "T/R" }); } - + public void testWithMoreContents() throws Exception { performMoveToRoleFile_pass("T", "R2", new String[] { "T", "T/R2" }); } - + public void testFieldAndRole() throws Exception { performMoveToRoleFile_pass("T2", "R2", new String[] { "T2", "T2/R2" }); } diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/AllTests.java index 065cb33d8..7d4fb4b59 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/AllTests.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/AllTests.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -29,7 +29,7 @@ import junit.framework.TestSuite; /**
* @author brcan
- *
+ *
* Runs all OT-specific refactoring tests and corresponding eclipse refactoring tests
*/
public class AllTests
@@ -48,7 +48,7 @@ public class AllTests suite.addTest(org.eclipse.objectteams.otdt.ui.tests.refactoring.util.RefactoringUtilTest.suite()); suite.addTest(TypeHelperGetInheritedMethodsTest.suite()); -
+
return suite;
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/RefactoringUtilTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/RefactoringUtilTest.java index 8511e0dfd..d0fb42497 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/RefactoringUtilTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/RefactoringUtilTest.java @@ -1,11 +1,11 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ * * SPDX-License-Identifier: EPL-2.0 * $Id$ - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -47,24 +47,24 @@ public class RefactoringUtilTest extends FileBasedRefactoringTest private IType _c; private IType _itest1; private IType _itest2; - + private IRoleType _team1role1; private IRoleType _team2role1; - + private IRoleType _team3role2; private IRoleType _team4role2; - + private IMethod _team2role1m1; private IMethod _team2role1m2; private IMethod _itest2m1; - + private IMethod _cm1; private IMethod _cm2; private IMethod _team4role2m1; private IMethod _team4role2m2; - + ITypeHierarchy _hierarchy; - + public RefactoringUtilTest(String name) { super(name); @@ -74,7 +74,7 @@ public class RefactoringUtilTest extends FileBasedRefactoringTest { return new Suite(RefactoringUtilTest.class); } - + /** * Creates a team hierarchy with implicit role type inheritance. */ @@ -82,110 +82,110 @@ public class RefactoringUtilTest extends FileBasedRefactoringTest { setTestProjectDir("RefactoringUtil"); super.setUpSuite(); - + _a = getType(getTestProjectDir(), "src", "rolehierarchy1", "A"); - + _aa = getType(getTestProjectDir(), "src", "rolehierarchy1", "AA"); - + _b = getType(getTestProjectDir(), "src", "rolehierarchy1", "B"); - + _c = getType(getTestProjectDir(), "src", "rolehierarchy1", "C"); - + _itest1 = getType(getTestProjectDir(), "src", "rolehierarchy1", "ITest1"); - + _itest2 = getType(getTestProjectDir(), "src", "rolehierarchy1", "ITest2"); - + _team1role1 = getRole(getTestProjectDir(), "src", "rolehierarchy1", "Team1", "Role1"); - + _team2role1 = getRole(getTestProjectDir(), "src", "rolehierarchy1", "Team2", "Role1"); - + _team3role2 = getRole(getTestProjectDir(), "src", "rolehierarchy1", "Team3", "Role2"); - + _team4role2 = getRole(getTestProjectDir(), "src", "rolehierarchy1", "Team4", "Role2"); - + _team2role1m1 = _team2role1.getMethods()[0]; _team2role1m2 = _team2role1.getMethods()[1]; - + _itest2m1 = _itest2.getMethods()[0]; - + _cm1 = _c.getMethods()[0]; _cm2 = _c.getMethods()[1]; _team4role2m2 = _team4role2.getMethods()[1]; _team4role2m1 = _team4role2.getMethods()[0]; - - + + _hierarchy = ((IType)_team4role2.getCorrespondingJavaElement()).newTypeHierarchy(null); } - + protected void setUp() throws Exception { super.setUp(); } - + public void testIsDeclaredInInterface_yes() throws JavaModelException { IMethod expected = _itest2m1; IMethod actual = RefactoringUtil.isDeclaredInInterface(_team2role1m1, _hierarchy, new NullProgressMonitor()); assertTrue(expected.equals(actual)); } - + public void testIsDeclaredInInterface_no1() throws JavaModelException { IMethod actual = RefactoringUtil.isDeclaredInInterface(_team2role1m2, _hierarchy, new NullProgressMonitor()); assertNull(actual); } - + public void testIsDeclaredInInterface_no2() throws JavaModelException { IMethod actual = RefactoringUtil.isDeclaredInInterface(_team4role2m2, _hierarchy, new NullProgressMonitor()); assertNull(actual); } - + public void testOverridesAnotherMethod_yes() throws JavaModelException { IMethod expected = _cm2; IMethod actual = RefactoringUtil.overridesAnotherMethod(_team4role2m2, _hierarchy, new NullProgressMonitor()); assertTrue(expected.equals(actual)); } - + public void testOverridesAnotherMethod_no() throws JavaModelException { IMethod actual = RefactoringUtil.overridesAnotherMethod(_team2role1m2, _hierarchy, new NullProgressMonitor()); diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/TypeHelperGetInheritedMethodsTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/TypeHelperGetInheritedMethodsTest.java index 7f3093a6e..8157054d8 100644 --- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/TypeHelperGetInheritedMethodsTest.java +++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/util/TypeHelperGetInheritedMethodsTest.java @@ -1,20 +1,20 @@ /********************************************************************** * This file is part of "Object Teams Development Tooling"-Software - * + * * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany, * for its Fraunhofer Institute and Computer Architecture and Software * Technology (FIRST), Berlin, Germany and Technical University Berlin, * Germany. - * + * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Please visit http://www.eclipse.org/objectteams for updates and contact. - * + * * Contributors: * Fraunhofer FIRST - Initial API and implementation * Technical University Berlin - Initial API and implementation @@ -55,8 +55,8 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest private IMethod _t2r1m5; private IMethod _t3r2m1; private IMethod _t3r2m3; - - + + public TypeHelperGetInheritedMethodsTest(String name) { @@ -67,7 +67,7 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest { return new Suite(TypeHelperGetInheritedMethodsTest.class); } - + /** * Creates a team hierarchy with implicit role type inheritance. */ @@ -75,14 +75,14 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest { setTestProjectDir("Hierarchy"); super.setUpSuite(); - + _t1r1 = getRole(getTestProjectDir(), "analysis", "rolehierarchy4", "T1", "R1"); - + _t2r1 = getRole(getTestProjectDir(), "analysis", @@ -96,14 +96,14 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest "rolehierarchy4", "T2", "R2"); - + _t3r1 = getRole(getTestProjectDir(), "analysis", "rolehierarchy4", "T3", "R1"); - + _t3r2 = getRole(getTestProjectDir(), "analysis", @@ -116,7 +116,7 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest "analysis", "rolehierarchy4", "C1"); - + _c1m1 = _c1.getMethods()[0]; _c1m2 = _c1.getMethods()[1]; _t1r1m3 = _t1r1.getMethods()[0]; @@ -124,12 +124,12 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest _t2r1m5 = _t2r1.getMethods()[1]; _t2r2m3 = _t2r2.getMethods()[0]; _t2r2m4 = _t2r2.getMethods()[1]; - + _t3r2m1 = _t3r2.getMethods()[0]; _t3r2m3 = _t3r2.getMethods()[1]; - + } - + protected void setUp() throws Exception { super.setUp(); @@ -141,13 +141,13 @@ public class TypeHelperGetInheritedMethodsTest extends FileBasedModelTest IMethod[] actual = RefactoringUtil.getInheritedMethods(_t3r2, false, false, true, new NullProgressMonitor()); assertTrue( compareMethods(expected, actual) ); } - + public void testGetInheritedMethodsFocusTypeIncluded() throws JavaModelException { IMethod[] expected = new IMethod[] {_t3r2m3, _t2r2m4, _t3r2m1, _c1m2}; IMethod[] actual = RefactoringUtil.getInheritedMethods(_t3r2, true, false, true, new NullProgressMonitor()); assertTrue( compareMethods(expected, actual) ); } - + //TODO(jsv) test with nested teams }
\ No newline at end of file |