Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-08-11 22:15:18 +0000
committerStephan Herrmann2012-08-11 22:15:18 +0000
commitdeda7932d41a672c6db5ac7bb7c84b0d06ad87fb (patch)
treecdd99a84e87f07f6b54603541bb397fd8e2792bd /testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring
parentbbd06a961329133604a68cfd41d482a8c7aafd26 (diff)
downloadorg.eclipse.objectteams-deda7932d41a672c6db5ac7bb7c84b0d06ad87fb.tar.gz
org.eclipse.objectteams-deda7932d41a672c6db5ac7bb7c84b0d06ad87fb.tar.xz
org.eclipse.objectteams-deda7932d41a672c6db5ac7bb7c84b0d06ad87fb.zip
Bug 386587 - [refactoring] pull-up refactoring cannot handle callout
bindings - support creation of new callout bindings - support removal of callout declarations
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/src/org/eclipse/objectteams/otdt/ui/tests/refactoring/pullup/PullUpTests.java26
1 files changed, 9 insertions, 17 deletions
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 ef4613737..cafbe2485 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
@@ -20,6 +20,7 @@
**********************************************************************/
package org.eclipse.objectteams.otdt.ui.tests.refactoring.pullup;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -52,6 +53,7 @@ import org.eclipse.objectteams.otdt.ui.tests.refactoring.RefactoringTest;
*
* @author Johannes Gebauer
*/
+@SuppressWarnings("restriction")
public class PullUpTests extends RefactoringTest {
private static final String REFACTORING_PATH = "PullUp/";
@@ -81,19 +83,6 @@ public class PullUpTests extends RefactoringTest {
return cus;
}
- private String createInputTestFileName(ICompilationUnit[] cus, int idx) {
- return getInputTestFileName(getSimpleNameOfCu(cus[idx].getElementName()));
- }
-
- private String createOutputTestFileName(ICompilationUnit[] cus, int idx) {
- return getOutputTestFileName(getSimpleNameOfCu(cus[idx].getElementName()));
- }
-
- private String getSimpleNameOfCu(String compUnit) {
- int dot = compUnit.lastIndexOf('.');
- return compUnit.substring(0, dot);
- }
-
private void setTargetClass(PullUpRefactoringProcessor processor, int targetClassIndex) throws JavaModelException {
IType[] possibleClasses = getPossibleTargetClasses(processor);
processor.setDestinationType(getPossibleTargetClasses(processor)[possibleClasses.length - 1 - targetClassIndex]);
@@ -104,8 +93,8 @@ public class PullUpTests extends RefactoringTest {
}
private static IMethod[] getMethods(IMember[] members) {
- List l = Arrays.asList(JavaElementUtil.getElementsOfType(members, IJavaElement.METHOD));
- return (IMethod[]) l.toArray(new IMethod[l.size()]);
+ List<IJavaElement> l = Arrays.asList(JavaElementUtil.getElementsOfType(members, IJavaElement.METHOD));
+ return l.toArray(new IMethod[l.size()]);
}
private static PullUpRefactoringProcessor createRefactoringProcessor(IMember[] methods) throws JavaModelException {
@@ -150,10 +139,13 @@ public class PullUpTests extends RefactoringTest {
setTargetClass(processor, targetClassIndex);
+ List<IMethod> methodList = new ArrayList<>();
if (deleteAllInSourceType)
- processor.setDeletedMethods(methods);
+ methodList.addAll(Arrays.asList(methods));
if (deleteAllMatchingMethods)
- processor.setDeletedMethods(getMethods(processor.getMatchingElements(new NullProgressMonitor(), false)));
+ methodList.addAll(Arrays.asList(getMethods(processor.getMatchingElements(new NullProgressMonitor(), false))));
+ if (!methodList.isEmpty())
+ processor.setDeletedMethods(methodList.toArray(new IMethod[methodList.size()]));
RefactoringStatus checkInputResult = ref.checkFinalConditions(new NullProgressMonitor());
assertTrue("precondition was supposed to pass", !checkInputResult.hasError());

Back to the top