Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests/src')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestAdjuster.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java104
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java230
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java228
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java146
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java66
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java54
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java74
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java104
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java562
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java20
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/HierarchicalASTVisiting.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/JavaQuickFixTests.java56
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java92
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java32
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java28
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java46
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/PrecedenceQuickFixTest.java18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java6
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StatementQuickFixTest.java20
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java138
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/rule/ProjectTestSetup.java2
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java132
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java152
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TraditionalHierarchyContentProviderTests.java124
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java36
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java382
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java150
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java28
43 files changed, 1599 insertions, 1599 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java
index 919c29497..d74c98100 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java
index eb7c6ffa7..ff8a485fc 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestAdjuster.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestAdjuster.java
index a43017391..394dbfc80 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestAdjuster.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestAdjuster.java
@@ -1,17 +1,17 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2014 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
**********************************************************************/
@@ -38,7 +38,7 @@ public team class TestAdjuster {
within(this)
base.changeNumberOfExpectedProblems();
}
-
+
protected class Collect playedBy QuickFixTest {
collectAllCorrections <- replace collectAllCorrections;
@@ -48,6 +48,6 @@ public team class TestAdjuster {
{
base.collectAllCorrections(iCompilationUnit, compilationUnit, nProblems == 9 ? 10 : nProblems);
}
- }
+ }
}
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java
index 326c2fd5c..864b5415d 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.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
@@ -43,7 +43,7 @@ public class TestPlugin extends AbstractUIPlugin {
private static TestPlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle;
-
+
/**
* The constructor.
*/
@@ -62,7 +62,7 @@ public class TestPlugin extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
-
+
disableCallinMarkers();
}
@@ -106,7 +106,7 @@ public class TestPlugin extends AbstractUIPlugin {
public ResourceBundle getResourceBundle() {
return resourceBundle;
}
-
+
public File getFileInPlugin(IPath path)
{
try
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java
index 9f6bf7a30..1adeb5617 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.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
@@ -71,7 +71,7 @@ public class CallinMarkerTests extends FileBasedUITest
private IType _baseType;
private IResource _baseResource;
private MyCallinMarkerCreator _creator;
-
+
private class MyCallinMarkerCreator extends CallinMarkerCreator2
{
private boolean _finished = false;
@@ -80,7 +80,7 @@ public class CallinMarkerTests extends FileBasedUITest
{
return _finished;
}
-
+
public void reset() {
this._finished = false;
}
@@ -92,7 +92,7 @@ public class CallinMarkerTests extends FileBasedUITest
this.annotationHelper = new AnnotationHelper(targetEditor, targetEditor.getEditorInput());
}
}
-
+
protected void schedule(final CallinMarkerJob job,
IStatusLineManager statusLine)
{
@@ -110,7 +110,7 @@ public class CallinMarkerTests extends FileBasedUITest
return this._currentJob != null;
}
}
-
+
public CallinMarkerTests(String name)
{
super(name);
@@ -126,19 +126,19 @@ public class CallinMarkerTests extends FileBasedUITest
junit.framework.TestSuite suite = new Suite(CallinMarkerTests.class.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
enableUiMonitoring(false);
setTestProjectDir("CallinMarker");
-
+
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
-
+
_creator = new MyCallinMarkerCreator();
_creator.setEnabled(true);
System.out.println("Running test: "+this.getName());
@@ -203,9 +203,9 @@ public class CallinMarkerTests extends FileBasedUITest
project.open(null);
}
};
- getWorkspace().run(populate, null);
+ getWorkspace().run(populate, null);
}
-
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
ICompilationUnit typeUnit = getCompilationUnit(
@@ -214,13 +214,13 @@ public class CallinMarkerTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
+ }
private void synchronousCreateMarkers(IResource resource) throws PartInitException, JavaModelException
{
@@ -248,22 +248,22 @@ public class CallinMarkerTests extends FileBasedUITest
fail("Interrupted while waiting for CallinMarkerCreator");
}
}
-
+
// The markers appear in undefined order, so we need to look them up in a Set
private void assertMarkers(Set<String> expectedMarkers, IMarker[] markers)
{
assertNotNull(markers);
assertNotNull(expectedMarkers);
-
+
assertEquals("Wrong number of markers", expectedMarkers.size(), markers.length);
-
+
try {
for (int i = 0; i < markers.length; i++)
{
assertNotNull(markers[i]);
String methodId = (String) markers[i].getAttribute(CallinMarker.ATTR_BASE_ELEMENT);
assertNotNull("CallinMarker without methodId attribute", methodId);
-
+
boolean isExpected = expectedMarkers.contains(methodId);
assertTrue("Unexpected marker found for method id: " + methodId, isExpected);
}
@@ -294,7 +294,7 @@ public class CallinMarkerTests extends FileBasedUITest
_baseResource = _baseType.getResource();
assertNotNull(_baseResource);
-
+
synchronousCreateMarkers(_baseResource);
Set<String> expectedMarkers = new HashSet<String>();
@@ -302,11 +302,11 @@ public class CallinMarkerTests extends FileBasedUITest
expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm2");
expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm3");
expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm4");
-
+
IMarker[] markers = getCallinMarkers(_baseResource);
assertMarkers(expectedMarkers, markers);
}
-
+
/** compute marker although one baseclass is missing. */
public void testMarkers_2() throws JavaModelException, PartInitException
{
@@ -314,12 +314,12 @@ public class CallinMarkerTests extends FileBasedUITest
_baseResource = _baseType.getResource();
assertNotNull(_baseResource);
-
+
synchronousCreateMarkers(_baseResource);
Set<String> expectedMarkers = new HashSet<String>();
expectedMarkers.add("=CallinMarker/src<bar{BaseTeam.java[BaseTeam~murx");
-
+
IMarker[] markers = getCallinMarkers(_baseResource);
assertMarkers(expectedMarkers, markers);
}
@@ -330,16 +330,16 @@ public class CallinMarkerTests extends FileBasedUITest
_baseResource = _baseType.getResource();
assertNotNull(_baseResource);
-
+
synchronousCreateMarkers(_baseResource);
Set<String> expectedMarkers = new HashSet<String>();
expectedMarkers.add("=CallinMarker/src<cycle{Base1.java[Base1[Inner~foo");
-
+
IMarker[] markers = getCallinMarkers(_baseResource);
assertMarkers(expectedMarkers, markers);
}
-
+
/** Cycle a la https://bugs.eclipse.org/303474 and callin-to-callin */
public void testMarkers_4() throws JavaModelException, PartInitException
{
@@ -347,37 +347,37 @@ public class CallinMarkerTests extends FileBasedUITest
_baseResource = _baseType.getResource();
assertNotNull(_baseResource);
-
+
synchronousCreateMarkers(_baseResource);
Set<String> expectedMarkers = new HashSet<String>();
expectedMarkers.add("=CallinMarker/src<cycle2{B.java[B[R~run");
-
+
IMarker[] markers = getCallinMarkers(_baseResource);
assertMarkers(expectedMarkers, markers);
}
-
+
// see http://trac.objectteams.org/ot/ticket/188
public void testMarkers_NonJavaPrj1() throws CoreException, IOException, InterruptedException
- {
+ {
createNonJavaPrj("NonJavaPrj");
MyLogListener myLogListener = new MyLogListener();
// can't use startLogListening() because we need to listen to RuntimeLog.
RuntimeLog.addLogListener(myLogListener);
-
+
try {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/folder/File.java"));
-
+
synchronousCreateMarkers(resource);
-
+
// wait for logging to occur after job is done:
while(this._creator.isCreatingMarkersFor(resource))
Thread.sleep(100);
-
+
if (!myLogListener.status.isEmpty())
fail("Unexpected Log: "+myLogListener.status.get(0));
-
+
IMarker[] markers = getCallinMarkers(resource);
assertEquals("Should have no markers", markers.length, 0);
} finally {
@@ -385,7 +385,7 @@ public class CallinMarkerTests extends FileBasedUITest
deleteProject("NonJavaPrj");
}
}
-
+
// see http://trac.objectteams.org/ot/ticket/188
public void testMarkers_NonJavaPrj2() throws CoreException, IOException, InterruptedException
{
@@ -393,23 +393,23 @@ public class CallinMarkerTests extends FileBasedUITest
MyLogListener myLogListener = new MyLogListener();
// can't use startLogListening() because we need to listen to RuntimeLog.
RuntimeLog.addLogListener(myLogListener);
-
+
try {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/folder/File.java"));
-
+
// cu pretends to exist when previously opened in a java editor
JavaUI.openInEditor(JavaCore.create(resource));
-
+
synchronousCreateMarkers(resource);
-
+
// wait for logging to occur after job is done:
while(this._creator.isCreatingMarkersFor(resource))
Thread.sleep(100);
-
+
if (!myLogListener.status.isEmpty())
fail("Unexpected Log: "+myLogListener.status.get(0));
-
+
IMarker[] markers = getCallinMarkers(resource);
assertEquals("Should have no markers", markers.length, 0);
} finally {
@@ -417,7 +417,7 @@ public class CallinMarkerTests extends FileBasedUITest
deleteProject("NonJavaPrj");
}
}
-
+
// see http://trac.objectteams.org/ot/ticket/188
public void testMarkers_NonJavaPrj3() throws CoreException, IOException, InterruptedException
{
@@ -425,27 +425,27 @@ public class CallinMarkerTests extends FileBasedUITest
MyLogListener myLogListener = new MyLogListener();
// can't use startLogListening() because we need to listen to RuntimeLog.
RuntimeLog.addLogListener(myLogListener);
-
+
try {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
// use classfile:
IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/bin/folder/File.class"));
-
+
// cu pretends to exist when previously opened in a java editor
JavaUI.openInEditor(JavaCore.create(resource));
-
+
synchronousCreateMarkers(resource);
-
+
// wait for logging to occur after job is done:
while(this._creator.isCreatingMarkersFor(resource))
Thread.sleep(100);
-
+
assertEquals("Unexpeted number of log entries", 1, myLogListener.status.size());
- assertEquals("Unexpected Log[0]",
+ assertEquals("Unexpected Log[0]",
"Status ERROR: org.eclipse.ui code=4 Unable to create part " +
"org.eclipse.ui.PartInitException: The class file is not on the classpath",
myLogListener.status.get(0).toString());
-
+
IMarker[] markers = getCallinMarkers(resource);
assertEquals("Should have no markers", markers.length, 0);
} finally {
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java
index 62182ee1e..8c9a84044 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java
index 2643eb5be..57a126b04 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.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
@@ -54,7 +54,7 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
private PackageExplorerContentProvider _testObj;
-
+
public ExternalDefinedRoleContentAndParentTests(String name)
{
super(name);
@@ -70,18 +70,18 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir("ExternalDefinedRole");
-
+
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
-
+
_testObj = new PackageExplorerContentProvider(true);
setShowTeamPackages(false);
}
@@ -90,7 +90,7 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
PackageExplorerAdaptor adaptor = PackageExplorerAdaptor.getInstance();
adaptor.setShowTeamPackages(show, _testObj);
}
-
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
@@ -100,20 +100,20 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
-
+ }
+
private IRoleType getRole(String srcFolderName, String pkgName, String teamName, String roleName) throws JavaModelException
{
IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
IOTJavaElement teamOTElem = OTModelManager.getOTElement(teamJavaElem);
assertNotNull(teamOTElem);
-
+
IOTType teamType = (IOTType) teamOTElem;
IType roleJavaElem = teamType.getRoleType(roleName);
// IType roleJavaElem = teamJavaElem.getType(roleName); // IOTType.getType() does not return role files!
@@ -124,251 +124,251 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
}
return null;
}
-
-
+
+
public void testRoleContent_EmptyRole() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 0);
}
-
+
public void testRoleContent_Field() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IField);
-
+
IField field = (IField) children[0];
assertEquals("roleAttr", field.getElementName());
assertEquals("QString;", field.getTypeSignature());
}
-
+
public void testRoleContent_ParameterlessMethod() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
+ assertEquals("()V", method.getSignature());
}
-
+
public void testRoleContent_MethodWithParameter() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals("roleMethod", method.getElementName());
- assertEquals("(QString;)V", method.getSignature());
+ assertEquals("(QString;)V", method.getSignature());
}
public void testRoleContent_MethodWithReturnValue() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()QString;", method.getSignature());
+ assertEquals("()QString;", method.getSignature());
}
-
+
public void testRoleContent_MethodWithThrowClause() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
-
+ assertEquals("()V", method.getSignature());
+
String[] exceptionTypes = method.getExceptionTypes();
assertNotNull(exceptionTypes);
assertTrue(exceptionTypes.length == 1);
assertEquals("QException;", exceptionTypes[0]);
}
-
+
public void testRoleContent_Innerclass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IType);
-
+
IType innerType = (IType) children[0];
assertEquals("AnInnerClass", innerType.getElementName());
- }
+ }
public void testRoleContent_InnerTeamClass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IType);
-
+
IType innerType = (IType) children[0];
assertEquals("AnInnerTeamClass", innerType.getElementName());
}
-
-
+
+
public void testRoleContent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
+ assertEquals("()V", method.getSignature());
}
-
+
public void testRoleContent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
//TODO (kaschja) change mapping name by the time there is a distinction of '->' and '=>' in the OT-Model
assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
+ assertEquals("()V", method.getSignature());
}
-
+
public void testRoleContent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_BEFORE);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
+ assertEquals("()V", method.getSignature());
}
-
+
public void testRoleContent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_REPLACE);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
+ assertEquals("()V", method.getSignature());
}
-
+
public void testRoleContent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_AFTER);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals("roleMethod", method.getElementName());
- assertEquals("()V", method.getSignature());
- }
+ assertEquals("()V", method.getSignature());
+ }
//************************************************************
// from here: testRoleParent
-//************************************************************
+//************************************************************
public void testRoleParent_EmptyRole() throws JavaModelException
{
IRoleType roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_1", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_EmptyRole_PhysicalView() throws JavaModelException
{
IRoleType roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
assertNotNull(roleOTElem);
-
+
setShowTeamPackages(true);
Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
@@ -377,24 +377,24 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
assertTrue("second level parent should be IPackageFragment", parent instanceof IPackageFragment);
assertEquals("Team package should have team name", "teampkg.Team_1", ((IPackageFragment)parent).getElementName());
}
-
+
public void testRoleParent_RoleWithField() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_2", ((IType)parent).getElementName());
- }
-
+ }
+
public void testRoleParent_RoleWithParameterlessMethod() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_3a", ((IType)parent).getElementName());
@@ -404,41 +404,41 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_3b", ((IType)parent).getElementName());
- }
-
+ }
+
public void testRoleParent_RoleWithMethodWithReturnValue() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_3c", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_RoleWithMethodWithThrowClause() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_3d", ((IType)parent).getElementName());
- }
-
+ }
+
public void testRoleParent_RoleWithInnerclass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_4a", ((IType)parent).getElementName());
@@ -448,66 +448,66 @@ public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_4b", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_5a", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_5b", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_5c", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_5d", ((IType)parent).getElementName());
}
-
+
public void testRoleParent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals("Team_5e", ((IType)parent).getElementName());
- }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java
index 7ed4f72cc..771dc978b 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.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
@@ -47,9 +47,9 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
{
final int METHOD_IDX = 0;
final int MAPPING_IDX = 1;
-
+
private PackageExplorerContentProvider _testObj;
-
+
public InternalDefinedRoleContentAndParentTests(String name)
{
super(name);
@@ -65,21 +65,21 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir("InternalDefinedRole");
-
+
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
-
+
_testObj = new PackageExplorerContentProvider(true);
}
-
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
@@ -89,18 +89,18 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
-
+ }
+
private IOTJavaElement getRole(String srcFolderName, String pkgName, String teamName, String roleName) throws JavaModelException
{
IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
-
+
if (teamJavaElem != null)
{
IType roleJavaElem = teamJavaElem.getType(roleName);
@@ -115,143 +115,143 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
}
return null;
}
-
-
+
+
public void testRoleContent_EmptyRole() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 0);
}
-
+
public void testRoleContent_Field() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IField);
-
+
IField field = (IField) children[0];
assertEquals(field.getElementName(), "roleAttr");
assertEquals(field.getTypeSignature(), "QString;");
}
-
+
public void testRoleContent_ParameterlessMethod() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "roleMethod");
assertEquals(method.getSignature(), "()V");
}
-
+
public void testRoleContent_MethodWithParameter() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "(QString;)V");
+ assertEquals(method.getSignature(), "(QString;)V");
}
public void testRoleContent_MethodWithReturnValue() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()QString;");
+ assertEquals(method.getSignature(), "()QString;");
}
-
+
public void testRoleContent_MethodWithThrowClause() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "roleMethod");
assertEquals(method.getSignature(), "()V");
-
+
String[] exceptionTypes = method.getExceptionTypes();
assertNotNull(exceptionTypes);
assertTrue(exceptionTypes.length == 1);
assertEquals(exceptionTypes[0], "QException;");
}
-
+
public void testRoleContent_Innerclass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IType);
-
+
IType innerType = (IType) children[0];
assertEquals(innerType.getElementName(), "AnInnerClass");
- }
+ }
public void testRoleContent_InnerTeamClass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IType);
-
+
IType innerType = (IType) children[0];
assertEquals(innerType.getElementName(), "AnInnerTeamClass");
}
-
-
+
+
public void testRoleContent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
-
+
//*********
// Logger.println(children.length);
// for (int idx = 0; idx < children.length; idx++)
@@ -260,126 +260,126 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
// }
assertTrue(children.length == 2);
//*********
-
+
assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()V");
+ assertEquals(method.getSignature(), "()V");
}
-
+
public void testRoleContent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
//TODO (kaschja) change mapping name by the time there is a distinction of '->' and '=>' in the OT-Model
assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()V");
+ assertEquals(method.getSignature(), "()V");
}
-
+
public void testRoleContent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_BEFORE);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()V");
+ assertEquals(method.getSignature(), "()V");
}
-
+
public void testRoleContent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_REPLACE);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()V");
+ assertEquals(method.getSignature(), "()V");
}
-
+
public void testRoleContent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
assertNotNull(roleOTElem);
-
+
Object[] children = _testObj.getChildren(roleOTElem);
assertNotNull(children);
assertTrue(children.length == 2);
-
+
assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
assertEquals("roleMethod <- baseMethod", mapping.getElementName());
assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_AFTER);
-
+
assertTrue(children[METHOD_IDX] instanceof IMethod);
IMethod method = (IMethod) children[METHOD_IDX];
assertEquals(method.getElementName(), "roleMethod");
- assertEquals(method.getSignature(), "()V");
- }
+ assertEquals(method.getSignature(), "()V");
+ }
//************************************************************
// from here: testRoleParent
-//************************************************************
+//************************************************************
public void testRoleParent_EmptyRole() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_1");
}
-
+
public void testRoleParent_RoleWithField() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_2");
- }
-
+ }
+
public void testRoleParent_RoleWithParameterlessMethod() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_3a");
@@ -389,41 +389,41 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_3b");
- }
-
+ }
+
public void testRoleParent_RoleWithMethodWithReturnValue() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_3c");
}
-
+
public void testRoleParent_RoleWithMethodWithThrowClause() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_3d");
- }
-
+ }
+
public void testRoleParent_RoleWithInnerclass() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_4a");
@@ -433,66 +433,66 @@ public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
{
IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
assertNotNull(roleOTElem);
-
- Object parent = _testObj.getParent(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_4b");
}
-
+
public void testRoleParent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_5a");
}
-
+
public void testRoleParent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_5b");
}
-
+
public void testRoleParent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_5c");
}
-
+
public void testRoleParent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_5d");
}
-
+
public void testRoleParent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
{
IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
assertNotNull(roleOTElem);
Object parent = _testObj.getParent(roleOTElem);
-
+
assertNotNull(parent);
assertTrue(parent instanceof IType);
assertEquals(((IType)parent).getElementName(), "Team_5e");
- }
-
+ }
+
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java
index 84523867c..16e762520 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.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
@@ -38,14 +38,14 @@ public class Logger
System.out.println(obj.toString());
}
}
-
+
// public static void println(String text)
// {
// System.out.println(text);
// }
-
+
public static void println(int number)
{
System.out.println(number);
- }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java
index 4e45717de..6c5b60ac6 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.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
@@ -44,10 +44,10 @@ import org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider;
*/
public class TeamContentTests extends FileBasedUITest
{
-
+
private PackageExplorerContentProvider _testObj;
-
-
+
+
public TeamContentTests(String name)
{
super(name);
@@ -63,20 +63,20 @@ public class TeamContentTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir("TeamProject");
-
+
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
_testObj = new PackageExplorerContentProvider(true);
}
-
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
@@ -86,18 +86,18 @@ public class TeamContentTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
-
+ }
+
private IOTJavaElement getTeam(String srcFolderName, String pkgName, String teamName) throws JavaModelException
{
IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
-
+
if (teamJavaElem != null)
{
IOTJavaElement teamOTElem = OTModelManager.getOTElement(teamJavaElem);
@@ -108,184 +108,184 @@ public class TeamContentTests extends FileBasedUITest
}
return null;
}
-
-
+
+
public void testTeamContent_EmptyTeam() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "EmptyTeam");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 0);
}
-
+
public void testTeamContent_Field() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithField");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IField);
-
+
IField field = (IField) children[0];
assertEquals(field.getElementName(), "teamlevelField");
assertEquals(field.getTypeSignature(), "QString;");
}
-
+
public void testTeamContent_ParameterlessMethod() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithParameterlessMethod");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "teamlevelMethod");
assertEquals(method.getSignature(), "()V");
}
-
+
public void testTeamContent_MethodWithParameter() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithParameter");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "teamlevelMethod");
- assertEquals(method.getSignature(), "(QString;)V");
+ assertEquals(method.getSignature(), "(QString;)V");
}
public void testTeamContent_MethodWithReturnValue() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithReturnValue");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "teamlevelMethod");
- assertEquals(method.getSignature(), "()QString;");
+ assertEquals(method.getSignature(), "()QString;");
}
-
+
public void testTeamContent_MethodWithThrowClause() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithThrowClause");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IMethod);
-
+
IMethod method = (IMethod) children[0];
assertEquals(method.getElementName(), "teamlevelMethod");
assertEquals(method.getSignature(), "()V");
-
+
String[] exceptionTypes = method.getExceptionTypes();
assertNotNull(exceptionTypes);
assertTrue(exceptionTypes.length == 1);
assertEquals(exceptionTypes[0], "QException;");
}
-
+
public void testTeamContent_InnerRoleClass() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithRoleClass");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
-
+
// Logger.println(children.length);
// Logger.println(((IRoleType)children[0]).getElementName());
-
+
assertTrue(children.length == 1);
-
+
assertTrue(children[0] instanceof IRoleType);
-
+
IRoleType innerType = (IRoleType) children[0];
assertEquals(innerType.getElementName(), "RoleClass");
- }
+ }
public void testTeamContent_InnerTeamClass() throws JavaModelException
{
IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithInnerTeamClass");
assertNotNull(teamOTElem);
-
+
Object[] children = _testObj.getChildren(teamOTElem);
-
+
assertNotNull(children);
-
+
// Logger.println(children.length);
// Logger.println(((IRoleType)children[0]).getElementName());
-
+
assertTrue(children.length == 1);
assertTrue(children[0] instanceof IRoleType);
-
+
IRoleType innerType = (IRoleType) children[0];
assertEquals(innerType.getElementName(), "InnerTeamClass");
- //TODO (kaschja) comment in next line by the time team cascading is supported
+ //TODO (kaschja) comment in next line by the time team cascading is supported
//assertTrue(innerType.isTeam());
}
-
-//TODO (kaschja) test containment of external defined role classes in a team depending on user defined visibility specification for external role packages
+
+//TODO (kaschja) test containment of external defined role classes in a team depending on user defined visibility specification for external role packages
// public void testTeamContent_ExternalDefinedRoleClass() throws JavaModelException
// {
// PackageExplorerPart part = new PackageExplorerPart();
// part.createPartControl(null);
-//
+//
// PackageExplorerContentProvider contentProviderToTest = part.getContentProvider();
-// HideExternalRolePackagesAction hideRolesAction = contentProviderToTest.getHideRolesAction();
+// HideExternalRolePackagesAction hideRolesAction = contentProviderToTest.getHideRolesAction();
// IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithExternalDefinedRoleClass");
// Object[] children;
-//
+//
// assertNotNull(contentProviderToTest);
// assertNotNull(hideRolesAction);
// assertNotNull(teamOTElem);
-//
-//
+//
+//
// if (!hideRolesAction.isRolePackageVisible())
// {
-// //switch the state to "role package is visible"
+// //switch the state to "role package is visible"
// _hideExternalRolesAction.run();
// }
// assertTrue(hideRolesAction.isRolePackageVisible());
-//
+//
// children = contentProviderToTest.getChildren(teamOTElem);
-//
+//
// assertNotNull(children);
// assertTrue(children.length == 1);
// assertTrue(children[0] instanceof IRoleType);
-//
+//
// IRoleType innerType = (IRoleType) children[0];
-// assertEquals(innerType.getElementName(), "RoleClass");
-//
-//
-// //switch the state to "role package is NOT visible"
+// assertEquals(innerType.getElementName(), "RoleClass");
+//
+//
+// //switch the state to "role package is NOT visible"
// hideRolesAction.run();
// assertTrue(!hideRolesAction.isRolePackageVisible());
-//
+//
// children = contentProviderToTest.getChildren(teamOTElem);
// assertNotNull(children);
-// assertTrue(children.length == 0);
-// }
+// assertTrue(children.length == 0);
+// }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java
index d43cdb805..000cd4396 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java
@@ -1,20 +1,20 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2004, 2016 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
@@ -48,7 +48,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class AddImportQuickFixTest extends OTQuickFixTest {
-
+
@Rule
public ProjectTestSetup projectsetup = new ProjectTestSetup();
@@ -66,39 +66,39 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
// team:
IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
buf = new StringBuffer();
- buf.append("package test.import1;\n");
+ buf.append("package test.import1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R2 playedBy test.base1.Base1 {\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= null;
for (Object prop : proposals)
if (prop instanceof CUCorrectionProposal && ((CUCorrectionProposal)prop).getRelevance() > 0)
proposal = (CUCorrectionProposal)prop;
assertNotNull("Need proposal with positive relevance", proposal);
assertEquals("Wrong quickfix label", "\"Change qualified reference to using 'import base test...Base1;'\"", proposal.getDisplayString());
-
+
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
buf.append("package test.import1;\n");
- buf.append("\n");
+ buf.append("\n");
buf.append("import base test.base1.Base1;\n");
- buf.append("\n");
+ buf.append("\n");
buf.append("public team class T {\n");
buf.append(" protected class R2 playedBy Base1 {\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
// ROFI variant:
@Test
public void testChangeFQNToBaseImport2() throws Exception {
@@ -114,30 +114,30 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
// team:
IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
buf = new StringBuffer();
- buf.append("package test.import1;\n");
+ buf.append("package test.import1;\n");
buf.append("public team class T {\n");
buf.append("}\n");
ICompilationUnit teamUnit = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
// ROFI:
IPackageFragment teamPack = fSourceFolder.createPackageFragment("test.import1.T", true, null);
buf = new StringBuffer();
- buf.append("team package test.import1.T;\n");
+ buf.append("team package test.import1.T;\n");
buf.append("protected class R2 playedBy test.base1.Base1 {\n");
buf.append("}\n");
ICompilationUnit cu= teamPack.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= null;
for (Object prop : proposals)
if (prop instanceof CUCorrectionProposal && ((CUCorrectionProposal)prop).getRelevance() > 0)
proposal = (CUCorrectionProposal)prop;
assertNotNull("Need proposal with positive relevance", proposal);
assertEquals("Wrong quickfix label", "\"Change qualified reference to using 'import base test...Base1;'\"", proposal.getDisplayString());
-
+
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
@@ -157,7 +157,7 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
assertEquals("Expected one import", 1, imports.length);
assertEquals("Unexpected import", "test.base1.Base1", imports[0].getElementName());
assertEquals("Expected base import", ExtraCompilerModifiers.AccBase, imports[0].getFlags());
-
+
// drop editors whose content has been modified by apply(),
// so that tearDown can delete files without asking the user:
Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
@@ -228,7 +228,7 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
// team:
IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
buf = new StringBuffer();
- buf.append("package test.import1;\n");
+ buf.append("package test.import1;\n");
buf.append("public team class T {\n");
buf.append("}\n");
pack1.createCompilationUnit("T.java", buf.toString(), false, null);
@@ -241,25 +241,25 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 6);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
buf.append("package test.import1;\n");
- buf.append("\n");
+ buf.append("\n");
buf.append("import base test.base.Base1;\n");
- buf.append("\n");
+ buf.append("\n");
buf.append("public team class T {\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
// this time files already have content
@Test
public void testAddBaseImportForRofi2() throws Exception {
@@ -298,18 +298,18 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 6);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
buf.append("package test.import1;\n");
- buf.append("\n");
+ buf.append("\n");
buf.append("import java.util.List;\n");
buf.append("\n");
buf.append("import base java.awt.Window;\n");
@@ -337,7 +337,7 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append(" public class R {}\n");
buf.append("}\n");
pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
// client
IPackageFragment pack2= fSourceFolder.createPackageFragment("test.import2", false, null);
buf = new StringBuffer();
@@ -352,12 +352,12 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack2.createCompilationUnit("C.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 7);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
@@ -395,7 +395,7 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append("public class R {}\n");
teampack.createCompilationUnit("R.java", buf.toString(), false, null);
-
+
// client
IPackageFragment pack2= fSourceFolder.createPackageFragment("test.import2", false, null);
buf = new StringBuffer();
@@ -410,12 +410,12 @@ public class AddImportQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack2.createCompilationUnit("C.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 7);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java
index a2efe699c..6a5c5d521 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.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
* Fraunhofer FIRST - Initial API and implementation
@@ -55,20 +55,20 @@ import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.tests.core.ProjectTestSetup;
-/** Structure is OT_COPY_PASTE from {@link org.eclipse.jdt.ui.tests.core.source.AddUnimplementedMethodsTest}
- * @since 1.2.1
+/** Structure is OT_COPY_PASTE from {@link org.eclipse.jdt.ui.tests.core.source.AddUnimplementedMethodsTest}
+ * @since 1.2.1
*/
public class AddUnimplementedMethodsTest extends TestCase {
-
+
private static final Class THIS= AddUnimplementedMethodsTest.class;
-
+
private IJavaProject fJavaProject;
private IPackageFragment fPackage;
-
+
public AddUnimplementedMethodsTest(String name) {
super(name);
}
-
+
public static Test allTests() {
return new ProjectTestSetup(new TestSuite(THIS));
}
@@ -80,24 +80,24 @@ public class AddUnimplementedMethodsTest extends TestCase {
TestSuite suite= new TestSuite();
suite.addTest(new AddUnimplementedMethodsTest("test1"));
return new ProjectTestSetup(suite);
- }
+ }
}
-
+
protected void setUp() throws Exception {
fJavaProject= JavaProjectHelper.createJavaProject("DummyProject", "bin");
assertNotNull(JavaProjectHelper.addRTJar(fJavaProject));
-
+
Hashtable<String,String> options= TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "999");
fJavaProject.setOptions(options);
-
+
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "${body_statement}\n// TODO", null);
-
+
IPackageFragmentRoot root= JavaProjectHelper.addSourceContainer(fJavaProject, "src");
fPackage= root.createPackageFragment("org.eclispe.objectteams.util", true, null);
-
+
IEclipsePreferences node= new ProjectScope(fJavaProject.getProject()).getNode(JavaUI.ID_PLUGIN);
node.putBoolean(PreferenceConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, false);
node.putBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
@@ -121,28 +121,28 @@ public class AddUnimplementedMethodsTest extends TestCase {
buf.append(" }\n");
buf.append("}\n");
fPackage.createCompilationUnit("F.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package org.eclipse.objectteams.util;\n");
ICompilationUnit cu= fPackage.createCompilationUnit("F2.java", buf.toString(), false, null);
-
+
IType testClass= cu.createType("public team class F2 extends F {\n\n}\n", null, true, null);
testClass = testClass.createType("public class R playedBy Object {\n\n}\n", null, true, null);
-
+
testHelper(testClass);
-
+
IMethod[] methods= testClass.getMethods();
checkMethods(new String[] { "b", "equals", "clone", "toString", "finalize", "hashCode" }, methods);
-
+
IImportDeclaration[] imports= cu.getImports();
checkImports(new String[]{"java.util.Properties"}, imports);
}
-
-
+
+
private void testHelper(IType testClass) throws JavaModelException, CoreException {
testHelper(testClass, -1, true);
}
-
+
private void testHelper(IType testClass, int insertionPos, boolean implementAllOverridable) throws JavaModelException, CoreException {
RefactoringASTParser parser= new RefactoringASTParser(AST.JLS8);
CompilationUnit unit= parser.parse(testClass.getCompilationUnit(), true);
@@ -150,14 +150,14 @@ public class AddUnimplementedMethodsTest extends TestCase {
assertNotNull("Could not find type declaration node", declaration);
ITypeBinding binding= declaration.resolveBinding();
assertNotNull("Binding for type declaration could not be resolved", binding);
-
+
IMethodBinding[] overridableMethods= implementAllOverridable ? StubUtility2Core.getOverridableMethods(unit.getAST(), binding, false) : null;
-
+
AddUnimplementedMethodsOperation op= new AddUnimplementedMethodsOperation(unit, binding, overridableMethods, insertionPos, true, true, true);
op.run(new NullProgressMonitor());
JavaModelUtil.reconcile(testClass.getCompilationUnit());
}
-
+
private void checkMethods(String[] expected, IMethod[] methods) {
int nMethods= methods.length;
int nExpected= expected.length;
@@ -166,8 +166,8 @@ public class AddUnimplementedMethodsTest extends TestCase {
String methName= expected[i];
assertTrue("method " + methName + " expected", nameContained(methName, methods));
}
- }
-
+ }
+
private void checkImports(String[] expected, IImportDeclaration[] imports) {
int nImports= imports.length;
int nExpected= expected.length;
@@ -197,5 +197,5 @@ public class AddUnimplementedMethodsTest extends TestCase {
}
}
return false;
- }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java
index 64f831c9e..caf79e3a3 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java
@@ -1,20 +1,20 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2004, 2016 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
@@ -46,7 +46,7 @@ import org.junit.Test;
*/
@RunWith(JUnit4.class)
public class CallinQuickFixTest extends OTQuickFixTest {
-
+
@Rule
public ProjectTestSetup projectsetup = new ProjectTestSetup();
@@ -69,7 +69,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -82,7 +82,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -90,7 +90,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[2];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -121,7 +121,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\")\n");
@@ -132,7 +132,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -140,7 +140,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[2];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");// removed callin modifier
@@ -151,7 +151,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
expectedProposals[0] = buf.toString();
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\")\n");
@@ -179,7 +179,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");
@@ -189,7 +189,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo() <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -199,7 +199,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");
@@ -306,7 +306,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") <E1, E2> E1 foo(E2 e) {\n");
@@ -316,7 +316,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo(E2 e) <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -326,7 +326,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") <E1, E2> E1 foo(E2 e) {\n");
@@ -353,7 +353,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo(int one, int two) {\n");
@@ -366,7 +366,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo(int one,//eol");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -376,7 +376,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo(int one, int two) {\n");
@@ -404,7 +404,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");
@@ -414,7 +414,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -424,7 +424,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");
@@ -450,7 +450,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") <E1, E2 extends java.util.List<E1>> E1 foo(E2 val) {\n");
@@ -460,7 +460,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -470,7 +470,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\") <E1, E2 extends java.util.List<E1>> E1 foo(E2 val) {\n");
@@ -497,7 +497,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo() {\n");
@@ -507,7 +507,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("foo <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -517,7 +517,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo() {\n");
@@ -529,8 +529,8 @@ public class CallinQuickFixTest extends OTQuickFixTest {
expectedProposals[0] = buf.toString();
assertExpectedExistInProposals(proposals, expectedProposals);
-
-
+
+
String[] alternatives = {"void foo()", "void foo(String val)"};
assertChoices((ICompletionProposal) proposals.get(0), "basemethod", alternatives);
}
@@ -550,7 +550,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void bar(R r, Number n) {\n");
@@ -560,7 +560,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("bar <- after");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -570,7 +570,7 @@ public class CallinQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void bar(R r, Number n) {\n");
@@ -582,8 +582,8 @@ public class CallinQuickFixTest extends OTQuickFixTest {
expectedProposals[0] = buf.toString();
assertExpectedExistInProposals(proposals, expectedProposals);
-
-
+
+
String[] alternatives = {"void foo(B1 b, Integer val)", "void foo(B1 b, Integer val, int x)"};
assertChoices((ICompletionProposal) proposals.get(0), "basemethod", alternatives);
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java
index 8c4fe3d88..9e324e0e5 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java
@@ -1,20 +1,20 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2004, 2016 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
@@ -56,7 +56,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
super.addOptions(options);
options.put(OTDTPlugin.OT_COMPILER_INFERRED_CALLOUT, JavaCore.WARNING);
}
-
+
/* Converting a field read to explicitly use a callout-to-field. */
@Test
public void testConvertFieldAccessToCalloutCall1() throws Exception {
@@ -69,7 +69,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -78,7 +78,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
@@ -86,7 +86,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" int getVal() -> get int val;\n");
@@ -99,9 +99,9 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
expectedProposals[0] = buf.toString();
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
-
+
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
@@ -115,7 +115,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertExpectedExistInProposals(proposals, expectedProposals);
}
-
+
/* Converting a field read (this-qualified) to explicitly use a callout-to-field. */
@Test
public void testConvertFieldAccessToCalloutCall2() throws Exception {
@@ -128,7 +128,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -137,16 +137,16 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" int getVal() -> get int val;\n");
@@ -161,7 +161,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
@@ -175,7 +175,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertExpectedExistInProposals(proposals, expectedProposals);
}
-
+
/* Converting a field assignment to explicitly use a callout-to-field. */
@Test
public void testConvertFieldAccessToCalloutCall3() throws Exception {
@@ -188,7 +188,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -197,16 +197,16 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void setVal(int val) -> set int val;\n");
@@ -221,7 +221,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
@@ -235,7 +235,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertExpectedExistInProposals(proposals, expectedProposals);
}
-
+
/* Converting a field assignment (this-qualified) to explicitly use a callout-to-field. */
@Test
public void testConvertFieldAccessToCalloutCall4() throws Exception {
@@ -248,7 +248,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void foo(){\n");
@@ -257,16 +257,16 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void setVal(int val) -> set int val;\n");
@@ -276,13 +276,13 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
-
+
expectedProposals[0] = buf.toString();
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
@@ -295,8 +295,8 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertExpectedExistInProposals(proposals, expectedProposals);
}
-
-
+
+
/* Convert field access to call to existing callout-to-field. */
@Test
public void testConvertFieldAccessToCalloutCall5() throws Exception {
@@ -309,7 +309,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" int getVal() -> get int val;\n");
@@ -320,17 +320,17 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" int getVal() -> get int val;\n");
@@ -345,7 +345,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" int getVal() -> get int val;\n");
@@ -373,7 +373,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void setVal(int val) -> set int val;\n");
@@ -384,17 +384,17 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
String[] expectedProposals = new String[3];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void setVal(int val) -> set int val;\n");
@@ -409,7 +409,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertEquals("proposal label", "Configure problem severity", proposals.get(1).getDisplayString());
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" void setVal(int val) -> set int val;\n");
@@ -424,7 +424,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
assertExpectedExistInProposals(proposals, expectedProposals);
}
-
+
/* Remove signatures from a callout to field. */
@Test
@@ -438,7 +438,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo();\n");
@@ -446,7 +446,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("getFoo() -> get");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -456,7 +456,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo();\n");
@@ -480,7 +480,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo(Boolean b);\n");
@@ -488,7 +488,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("getFoo -> foo");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -498,7 +498,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo(Boolean b);\n");
@@ -522,15 +522,15 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo();\n");
- buf.append(" getFoo -> get foo;\n");
+ buf.append(" getFoo -> get foo;\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
int offset= buf.toString().indexOf("getFoo -> get");
AssistContext context= getCorrectionContext(cuteam, offset, 0);
List<IJavaCompletionProposal> proposals= collectAssists(context, false);
@@ -540,7 +540,7 @@ public class CalloutQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[1];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" abstract String getFoo();\n");
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
index 15cd834b6..cd90a3d4f 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
@@ -1,20 +1,20 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2004, 2016 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
@@ -87,9 +87,9 @@ import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Tests for code completion including the UI part
- * i.e., testing the actual rewriting and also selections.
- *
+ * Tests for code completion including the UI part
+ * i.e., testing the actual rewriting and also selections.
+ *
* @author stephan
* @since 1.1.8
*/
@@ -156,7 +156,7 @@ public class CodeCompletionTest extends CoreTests {
StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "//TODO\n${body_statement}", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.GETTERCOMMENT_ID, "/**\n * @return the ${bare_field_name}\n */", fJProject1);
StubUtility.setCodeTemplate(CodeTemplateContextType.SETTERCOMMENT_ID, "/**\n * @param ${param} the ${bare_field_name} to set\n */", fJProject1);
-
+
fBeforeImports= "";
fAfterImports= "";
fMembers= "";
@@ -173,14 +173,14 @@ public class CodeCompletionTest extends CoreTests {
closeAllEditors();
JavaProjectHelper.delete(fJProject1);
}
-
+
public static void closeEditor(IEditorPart editor) {
IWorkbenchPartSite site;
IWorkbenchPage page;
if (editor != null && (site= editor.getSite()) != null && (page= site.getPage()) != null)
page.closeEditor(editor, false);
}
-
+
public static void closeAllEditors() {
IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
for (int i= 0; i < windows.length; i++) {
@@ -208,7 +208,7 @@ public class CodeCompletionTest extends CoreTests {
String contents= buf.toString();
pack1.createCompilationUnit("B.java", contents, false, null);
-
+
// create team class:
IPackageFragment pack2= sourceFolder.createPackageFragment("test2", false, null);
buf= new StringBuffer();
@@ -222,7 +222,7 @@ public class CodeCompletionTest extends CoreTests {
contents= buf.toString();
ICompilationUnit cuT= pack2.createCompilationUnit("T.java", contents, false, null);
-
+
fEditor= (JavaEditor)JavaUI.openInEditor(cuT);
String str= " fo";
@@ -245,7 +245,7 @@ public class CodeCompletionTest extends CoreTests {
assertNotNull("expected proposal", selected);
IDocument doc= fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
- selected.apply(doc);
+ selected.apply(doc);
buf= new StringBuffer();
buf.append("package test2;\n" +
@@ -275,15 +275,15 @@ public class CodeCompletionTest extends CoreTests {
ISourceViewer viewer= editor.getViewer();
return new JavaContentAssistInvocationContext(viewer, offset, editor);
}
-
+
// ==== START REAL TESTS: ====
-
+
/** At the empty space within a role one could create a constructor. */
public void testCreateRoleConstructor() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " |",
- "R(",
+ " |",
+ "R(",
" /**\n" +
" * Constructor.\n" +
" */\n" +
@@ -291,14 +291,14 @@ public class CodeCompletionTest extends CoreTests {
" //TODO\n" +
"\n" +
" }",
- INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
public void testCreateCallout1() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " fo|",
- "foo(",
+ " fo|",
+ "foo(",
"\n" + // TODO(SH): initial newline is not intended?
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
@@ -312,8 +312,8 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" abstract void foo();\n"+
- " fo|",
- "foo(",
+ " fo|",
+ "foo(",
" abstract void foo();\n"+
"\n" + // TODO(SH): initial newline is not intended?
" /* (non-Javadoc)\n" +
@@ -328,8 +328,8 @@ public class CodeCompletionTest extends CoreTests {
public void testCreateCallout2() throws Exception {
createBaseClass(" public void foo() {}\n");
assertROFIBodyProposal(
- " fo|",
- "foo(",
+ " fo|",
+ "foo(",
"\n" + // TODO(SH): initial newline is not intended?
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
@@ -338,26 +338,26 @@ public class CodeCompletionTest extends CoreTests {
" ",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
public void testCreateCalloutOverride1() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" public class MyRole {\n" +
" String blub(int i) { return \"\"; }\n" +
- " }\n" +
+ " }\n" +
"}\n",
true, null);
-
- pkg.createCompilationUnit("ABase.java",
+
+ pkg.createCompilationUnit("ABase.java",
"package test1.p1;\n" +
"public class ABase {\n" +
" String blub(int k) { return null; }\n" +
- "}\n",
+ "}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("\n");
@@ -367,8 +367,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" \n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("\n");
@@ -387,32 +387,32 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " ";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("String");
-
+
// discriminate from overriding "blub(int i)":
- assertProposal("blub(int k", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, "String".length()), 0);
+ assertProposal("blub(int k", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, "String".length()), 0);
}
-
-
+
+
// callout override to field
public void testCreateCalloutOverride2() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" public class MyRole {\n" +
" void setBlub(int i) { }\n" +
- " }\n" +
+ " }\n" +
"}\n",
true, null);
-
- pkg.createCompilationUnit("ABase.java",
+
+ pkg.createCompilationUnit("ABase.java",
"package test1.p1;\n" +
"public class ABase {\n" +
" int blub;\n" +
- "}\n",
+ "}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("import base test1.p1.ABase;\n");
@@ -421,8 +421,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" set\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("import base test1.p1.ABase;\n");
@@ -440,24 +440,24 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " set";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf(" ");
-
+
// discriminate from overriding "setBlub(int i)":
- assertProposal("setBlub(int)", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter+2, 0), 0);
+ assertProposal("setBlub(int)", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter+2, 0), 0);
}
-
-
+
+
// Bug 374840 - [assist] callout completion after parameter mapping garbles the code
public void testCreateCalloutOverride3() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
-
- pkg.createCompilationUnit("ABase.java",
+
+ pkg.createCompilationUnit("ABase.java",
"package test1.p1;\n" +
"public class ABase {\n" +
" Object blub;\n" +
- "}\n",
+ "}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import base test1.p1.ABase;\n");
subTeamContent.append("public team class Completion_testCreateCalloutOverride3 {\n");
@@ -467,8 +467,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" toStr\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import base test1.p1.ABase;\n");
expectedContent.append("public team class Completion_testCreateCalloutOverride3 {\n");
@@ -487,17 +487,17 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " toStr";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("String toString");
-
+
// discriminate from method override:
- assertProposal("toString() String", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, "String".length()), 0);
+ assertProposal("toString() String", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, "String".length()), 0);
}
-
+
public void testCompleteCallout1() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " void foo() ->|",
- "foo(",
+ " void foo() ->|",
+ "foo(",
" void foo() ->| void foo();|" + // SH: why selected?
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
@@ -506,9 +506,9 @@ public class CodeCompletionTest extends CoreTests {
public void testCompleteCallout2() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " foo -> |",
- "foo(",
- " foo -> foo; |" + // SH: trailing space?
+ " foo -> |",
+ "foo(",
+ " foo -> foo; |" + // SH: trailing space?
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
@@ -520,8 +520,8 @@ public class CodeCompletionTest extends CoreTests {
" callin void bar() {}\n"+
" void foo() ->|\n" + // no leading space, inserted below (good)
" bar <- replace clone;\n",
- "foo(",
- " callin void bar() {}\n" +
+ "foo(",
+ " callin void bar() {}\n" +
" void foo() ->| void foo();|\n" +
" bar <- replace clone;\n" +
"",
@@ -532,8 +532,8 @@ public class CodeCompletionTest extends CoreTests {
public void testCompleteCallout4() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " foo -> f|",
- "foo(",
+ " foo -> f|",
+ "foo(",
" foo -> |foo;|",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
@@ -541,28 +541,28 @@ public class CodeCompletionTest extends CoreTests {
public void testCompleteCallout5() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
- " |",
+ " |",
"foo(",
"\n"+
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
" */\n" +
" void |foo|() -> void foo();\n" +
- " ",
+ " ",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
public void testCompleteCallout6() throws Exception {
createBaseClass(" public void foo() {}\n");
assertROFIBodyProposal(
- " |",
+ " |",
"foo(",
"\n"+
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
" */\n" +
" void |foo|() -> void foo();\n" +
- " ",
+ " ",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
@@ -570,14 +570,14 @@ public class CodeCompletionTest extends CoreTests {
public void testCompleteCallout7() throws Exception {
createBaseClass(" public static void foo() {}\n");
assertROFIBodyProposal(
- " |",
+ " |",
"foo(",
"\n"+
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
" */\n" +
" void |foo|() -> void foo();\n" +
- " ",
+ " ",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
@@ -586,7 +586,7 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" java.util.List<String> names;\n");
assertNosuchTypeBodyProposal(
" String setName(int i, String n) -> set java.util.List<String> names\n" +
- " with { n -> base.| }",
+ " with { n -> base.| }",
"names",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
@@ -596,8 +596,8 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" java.util.List<String> names;\n");
assertTypeBodyProposal(
" String getName(int i) -> get java.util.List<String> names\n" +
- " with { result <- base.| }",
- "names",
+ " with { result <- base.| }",
+ "names",
" String getName(int i) -> get java.util.List<String> names\n" +
" with { result <- base.names|| }",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
@@ -619,15 +619,15 @@ public class CodeCompletionTest extends CoreTests {
String contents= buf.toString();
IPackageFragment basePkg = CompletionTestSetup.getAbsoluteTestPackage(this.fJProject1, "test1");
basePkg.createCompilationUnit("B.java", contents, true, null);
-
+
fAfterImports = "\n" +
"import test1.b1.B1;\n" +
"import test1.b1.B1.Inner;\n" +
"import test1.b2.B2;\n";
-
+
assertTypeBodyProposal(
- " |",
- "foo(",
+ " |",
+ "foo(",
"\n" +
" /* (non-Javadoc)\n" +
" * @see test1.B#foo(test1.b1.B1, test1.b1.B1.Inner, test1.b2.B2)\n" +
@@ -647,8 +647,8 @@ public class CodeCompletionTest extends CoreTests {
" String toString() => |String toString();|",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
-
+
+
/** A base method spec without return type and beginning of the selector is searched. */
public void testCompletionMethodSpecLong2() throws Exception {
createBaseClass("");
@@ -658,7 +658,7 @@ public class CodeCompletionTest extends CoreTests {
" String toString() => |String toString();|",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/** A base method spec with return type and no selector is searched. */
public void testCompletionMethodSpecLong3() throws Exception {
createBaseClass("");
@@ -668,7 +668,7 @@ public class CodeCompletionTest extends CoreTests {
" String toString() => String toString(); |", // trailing space?
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* short, no callinModifier, follows: method */
public void testCompleteCallin1() throws Exception {
createBaseClass(" public void foo() {}\n");
@@ -676,8 +676,8 @@ public class CodeCompletionTest extends CoreTests {
" void bar() {}\n"+
" bar <-|\n" + // no space, inserted below (good)
" void zork() {}\n",
- "foo(",
- " void bar() {}\n" +
+ "foo(",
+ " void bar() {}\n" +
" bar <- |before| foo;\n" +
" void zork() {}\n" +
"",
@@ -688,8 +688,8 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" void foo() {}\n"+
- " fo|",
- "foo(",
+ " fo|",
+ "foo(",
" void foo() {}\n"+
"\n" + // TODO(SH): initial newline is not intended?
" /* (non-Javadoc)\n" +
@@ -705,8 +705,8 @@ public class CodeCompletionTest extends CoreTests {
public void _testCreateCallin2() throws Exception {
createBaseClass(" public String foo() {}\n");
assertTypeBodyProposal(
- " fo|",
- "foo(",
+ " fo|",
+ "foo(",
"\n" + // TODO(SH): initial newline is not intended?
" /* (non-Javadoc)\n" +
" * @see test1.B#foo()\n" +
@@ -721,32 +721,32 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" void bar() {}\n"+
- " bar <- after |\n" +
+ " bar <- after |\n" +
" void foo() -> void foo();\n",
- "foo(",
- " void bar() {}\n" +
+ "foo(",
+ " void bar() {}\n" +
" bar <- after foo; |\n" + // SH: trailing space?
" void foo() -> void foo();\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
-
+
+
/* short, with callinModifier, follows: callout binding, non-keyword return type. */
public void testCompleteCallin2a() throws Exception {
createBaseClass(" public String foo() { return null; }\n");
assertTypeBodyProposal(
" String bar() { return \"\"; }\n"+
- " bar <- after |\n" +
+ " bar <- after |\n" +
" String foo() -> String foo();\n",
- "foo(",
- " String bar() { return \"\"; }\n" +
+ "foo(",
+ " String bar() { return \"\"; }\n" +
" bar <- after foo; |\n" + // SH: trailing space?
" String foo() -> String foo();\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* long, with callinModifier, follows: field. */
public void testCompleteCallin3() throws Exception {
createBaseClass(" public void foo() {}\n");
@@ -754,29 +754,29 @@ public class CodeCompletionTest extends CoreTests {
" void bar() {}\n"+
" void bar() <-after |\n" + // cannot insert space before modifier (OK)
" int i;\n",
- "foo(",
- " void bar() {}\n" +
- " void bar() <-after void foo(); |\n" +
+ "foo(",
+ " void bar() {}\n" +
+ " void bar() <-after void foo(); |\n" +
" int i;\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* long, no callinModifier, callin-method, follows: field. */
public void testCompleteCallin4() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" callin void bar() {}\n"+
- " void bar() <- |\n" +
+ " void bar() <- |\n" +
" int i;\n",
- "foo(",
- " callin void bar() {}\n" +
+ "foo(",
+ " callin void bar() {}\n" +
" void bar() <- |replace| void foo(); \n" +
" int i;\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* long, no callinModifier, callin-method, follows: method. */
public void testCompleteCallin5() throws Exception {
createBaseClass(" public void foo() {}\n");
@@ -784,14 +784,14 @@ public class CodeCompletionTest extends CoreTests {
" callin void bar() {}\n"+
" void bar() <-|\n" + // no leading space, inserted below (good)
" int zork() {}\n",
- "foo(",
- " callin void bar() {}\n" +
+ "foo(",
+ " callin void bar() {}\n" +
" void bar() <- |replace| void foo();\n" +
" int zork() {}\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* long, no callinModifier, callin-method, follows: short callin. */
public void testCompleteCallin6() throws Exception {
createBaseClass(" public void foo() {}\n");
@@ -799,8 +799,8 @@ public class CodeCompletionTest extends CoreTests {
" callin void bar() {}\n"+
" void bar() <-|\n" + // no leading space, inserted below (good)
" bar <- replace clone;\n",
- "foo(",
- " callin void bar() {}\n" +
+ "foo(",
+ " callin void bar() {}\n" +
" void bar() <- |replace| void foo();\n" +
" bar <- replace clone;\n" +
"",
@@ -812,31 +812,31 @@ public class CodeCompletionTest extends CoreTests {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" callin void bar() {}\n"+
- " bar <- replace |\n" +
+ " bar <- replace |\n" +
" bar <- replace clone;\n",
- "foo",
- " callin void bar() {}\n" +
+ "foo",
+ " callin void bar() {}\n" +
" bar <- replace foo; |\n" + // SH: trailing space?
" bar <- replace clone;\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
/* short, prefix typed, with callinModifier, follows: callout binding. */
public void testCompleteCallin8() throws Exception {
createBaseClass(" public void foo() {}\n");
assertTypeBodyProposal(
" void bar() {}\n"+
- " bar <- after f|\n" +
+ " bar <- after f|\n" +
" void foo() -> void foo();\n",
- "foo(",
- " void bar() {}\n" +
- " bar <- after |foo;|\n" +
+ "foo(",
+ " void bar() {}\n" +
+ " bar <- after |foo;|\n" +
" void foo() -> void foo();\n" +
"",
INTERESTING_CALLIN_CALLOUT_PROPOSAL);
}
-
+
public void testCompleteBasecall1() throws Exception {
createBaseClass(" public String getBaseText(Object object) {return null;}\n");
assertTypeBodyProposal(
@@ -852,7 +852,7 @@ public class CodeCompletionTest extends CoreTests {
"",
0); // should only have one proposal, so accept any to see if there are others
}
-
+
// static case, result ignored - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=331669
public void testCompleteBasecall2() throws Exception {
createBaseClass(" public static String getBaseText(Object object) {return null;}\n");
@@ -926,7 +926,7 @@ public class CodeCompletionTest extends CoreTests {
String str= "//here";
int offset= contents.indexOf(str);
-
+
fEditor= (JavaEditor) EditorUtility.openInEditor(cu1);
ICompletionProposal proposal= findNonNullProposal("", cu1, new Region(offset, 0), 0);
String expectedContents= "package test1;\n" +
@@ -978,7 +978,7 @@ public class CodeCompletionTest extends CoreTests {
codeComplete(cu1, offset, collector);
IJavaCompletionProposal[] proposals= collector.getJavaCompletionProposals();
-
+
// strictly expect one method only.
assertEquals(1, proposals.length);
assertAppliedProposal(contents, proposals[0], "foomethod();"); // arguments are not inserted by this method :(
@@ -1006,7 +1006,7 @@ public class CodeCompletionTest extends CoreTests {
// this is the interesting check: choices??
assertChoices(proposal, new String[][]{new String[]{"i", "idx", "0"}});
}
-
+
/* Full c-t-f declaration */
public void testCalloutToField1() throws Exception {
createBaseClass("public int myField;\n");
@@ -1102,13 +1102,13 @@ public class CodeCompletionTest extends CoreTests {
public void testPlayedBy1() throws Exception {
createBaseClass("test2", "MyBase", "");
fBeforeImports= "";
- fAfterImports= "\nimport base test2.MyBase;\n";
+ fAfterImports= "\nimport base test2.MyBase;\n";
assertTypeBodyProposal(
"protected class R playedBy MyBa| {\n" +
- "}\n",
+ "}\n",
"MyBase",
"protected class R playedBy MyBase| {\n" +
- "}\n",
+ "}\n",
0, false);
}
@@ -1119,13 +1119,13 @@ public class CodeCompletionTest extends CoreTests {
fAfterImports= "\n" +
"import java.util.Map;\n" +
"\n" +
- "import base test2.AClass;\n";
+ "import base test2.AClass;\n";
assertTypeBodyProposal(
"protected class AClass playedBy A| {\n" +
- "}\n",
- "ACl",
+ "}\n",
+ "ACl",
"protected class AClass playedBy AClass| {\n" +
- "}\n",
+ "}\n",
0, false);
}
@@ -1133,9 +1133,9 @@ public class CodeCompletionTest extends CoreTests {
// base import for other role already exists, correctly sort in.
public void testPlayedBy3() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "test3");
- pkg.createCompilationUnit("OtherBase.java",
+ pkg.createCompilationUnit("OtherBase.java",
"package test3;\n" +
- "public class OtherBase {}\n",
+ "public class OtherBase {}\n",
true, null);
createBaseClass("test2", "MyBase", "");
@@ -1147,19 +1147,19 @@ public class CodeCompletionTest extends CoreTests {
"import java.util.Map;\n" +
"\n" +
"import base test2.MyBase;\n" +
- "import base test3.OtherBase;\n";
+ "import base test3.OtherBase;\n";
assertTypeBodyProposal(
"protected class R playedBy MyBa| {\n" +
"}\n" +
"protected class R2 playedBy OtherBase {\n" +
" Map<String,String> f;\n" +
- "}\n",
+ "}\n",
"MyBase",
"protected class R playedBy MyBase| {\n" +
"}\n" +
"protected class R2 playedBy OtherBase {\n" +
" Map<String,String> f;\n" +
- "}\n",
+ "}\n",
0, false);
}
@@ -1179,7 +1179,7 @@ public class CodeCompletionTest extends CoreTests {
"}\n",
0, false);
}
-
+
public void testBaseGuard2() throws Exception {
createBaseClass("test2", "AClass", "");
assertTypeBodyProposal(
@@ -1256,7 +1256,7 @@ public class CodeCompletionTest extends CoreTests {
"}\n",
0, false);
}
-
+
// inside base guard of short method binding, field reference
// Bug 340083 - [assist] cannot complete inside a binding guard
public void testGuard7() throws Exception {
@@ -1297,19 +1297,19 @@ public class CodeCompletionTest extends CoreTests {
public void testRoleTag1() throws Exception {
IPackageFragment teamPkg = CompletionTestSetup.getTestPackage(this.fJProject1, "MyTeam");
- teamPkg.createCompilationUnit("MyRole.java",
+ teamPkg.createCompilationUnit("MyRole.java",
"team package test1.MyTeam;\n" +
- "public class MyRole {}\n",
+ "public class MyRole {}\n",
true, null);
- StringBuffer teamContent = new StringBuffer();
+ StringBuffer teamContent = new StringBuffer();
teamContent.append("package test1;\n");
teamContent.append("/** @role My */\n");
teamContent.append("public team class MyTeam {\n");
teamContent.append(" MyRole roleField;\n"); // trigger loading
teamContent.append(" protected class MyOtherRole {}\n");
teamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("/** @role MyRole */\n");
expectedContent.append("public team class MyTeam {\n");
@@ -1319,25 +1319,25 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "@role My";
int pos = teamContent.indexOf(completeAfter)+completeAfter.length();
-
+
assertProposal("My", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(pos+4, 0), 0); // 4: len(MyRole)-len(My)
}
-
+
public void testRoleTag2() throws Exception {
IPackageFragment teamPkg = CompletionTestSetup.getTestPackage(this.fJProject1, "MyTeam");
- teamPkg.createCompilationUnit("MyRole.java",
+ teamPkg.createCompilationUnit("MyRole.java",
"team package test1.MyTeam;\n" +
- "public class MyRole {}\n",
+ "public class MyRole {}\n",
true, null);
- StringBuffer teamContent = new StringBuffer();
+ StringBuffer teamContent = new StringBuffer();
teamContent.append("package test1;\n");
teamContent.append("/** @role */\n");
teamContent.append("public team class MyTeam {\n");
teamContent.append(" MyRole roleField;\n"); // trigger loading
teamContent.append(" protected class MyOtherRole {}\n");
teamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("/** @role MyRole */\n");
expectedContent.append("public team class MyTeam {\n");
@@ -1347,23 +1347,23 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "@role ";
int pos = teamContent.indexOf(completeAfter)+completeAfter.length();
-
- assertProposal("", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(pos+6, 0), 0); // 6: len(MyRole)
+
+ assertProposal("", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(pos+6, 0), 0); // 6: len(MyRole)
}
-
-
+
+
public void testCreateMethod1() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" public class MyRole {\n" +
" String blub(int i) { return \"\"; }\n" +
- " }\n" +
+ " }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testCreateMethod1 extends SuperTeam {\n");
@@ -1371,8 +1371,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" blu\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testCreateMethod1 extends SuperTeam {\n");
@@ -1391,21 +1391,21 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "blu";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("}")+1;
-
- assertProposal("", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+
+ assertProposal("", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
}
// Bug 362003 - [assist] completion is broken after <B base R> after a base guard
public void testCreateMethod2() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("BaseClass.java",
+ pkg.createCompilationUnit("BaseClass.java",
"package test1.p1;\n" +
"public class BaseClass {\n" +
" public void blub() {}\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import base test1.p1.BaseClass;\n");
subTeamContent.append("public team class Completion_testCreateMethod2 {\n");
@@ -1426,8 +1426,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" System.out.print(o);\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import base test1.p1.BaseClass;\n");
expectedContent.append("public team class Completion_testCreateMethod2 {\n");
@@ -1460,29 +1460,29 @@ public class CodeCompletionTest extends CoreTests {
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("super.foo()");
posAfter = expectedContent.indexOf("}", posAfter)+1;
-
- assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+
+ assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
}
// override role, simple case
public void testOverrideRole1() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" public class MyRole {\n" +
- " }\n" +
+ " }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
subTeamContent.append(" \n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
@@ -1494,33 +1494,33 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " ";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("}")+1;
-
- assertProposal("MyRole - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+
+ assertProposal("MyRole - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
}
-
+
// override role, role file with mentioning in the team
public void testOverrideRole2() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" RoleFile field\n;" + // help the compiler to find the role file
"}\n",
true, null);
IPackageFragment rolePack = CompletionTestSetup.getTestPackage(this.fJProject1, "p1.SuperTeam");
- rolePack.createCompilationUnit("RoleFile.java",
+ rolePack.createCompilationUnit("RoleFile.java",
"team package test1.p1.SuperTeam;\n" +
- "protected class RoleFile { }\n",
+ "protected class RoleFile { }\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
subTeamContent.append(" \n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
@@ -1532,32 +1532,32 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " ";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("}")+1;
-
- assertProposal("RoleFile - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
- }
-
+
+ assertProposal("RoleFile - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+ }
+
// override role, role file, without mentioning in the team (requires search engine help)
public void testOverrideRole3() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" + // no mentioning of RoleFile
"}\n",
true, null);
IPackageFragment rolePack = CompletionTestSetup.getTestPackage(this.fJProject1, "p1.SuperTeam");
- rolePack.createCompilationUnit("RoleFile.java",
+ rolePack.createCompilationUnit("RoleFile.java",
"team package test1.p1.SuperTeam;\n" +
- "protected class RoleFile { }\n",
+ "protected class RoleFile { }\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
subTeamContent.append(" \n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
@@ -1569,30 +1569,30 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = " ";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("}")+1;
-
- assertProposal("RoleFile - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
- }
+
+ assertProposal("RoleFile - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+ }
// Bug 355255 - [assist] NPE during completion if team contains an enum
public void testOverrideRole4() throws Exception {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" public class MyRole {\n" +
- " }\n" +
+ " }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
subTeamContent.append(" enum Aufzaehlung { EINS, ZWEI }\n");
subTeamContent.append(" \n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testOverrideRole1 extends SuperTeam {\n");
@@ -1605,8 +1605,8 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "}\n ";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf(" }")+5;
-
- assertProposal("MyRole - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+
+ assertProposal("MyRole - Override", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
}
// propose creating a team instance:
@@ -1674,9 +1674,9 @@ public class CodeCompletionTest extends CoreTests {
"import testutil.MyColl;\n" +
"\n" +
"import base test2.AClass;\n";
- createBaseClass("testutil", "MyColl", "<T> implements java.util.Collection<T>",
- " public void addAll(Collection<? extends E> other) {}\n" +
- " public E[] toArray() { return null; }\n" +
+ createBaseClass("testutil", "MyColl", "<T> implements java.util.Collection<T>",
+ " public void addAll(Collection<? extends E> other) {}\n" +
+ " public E[] toArray() { return null; }\n" +
" public int size() { return 1; }\n");
createBaseClass("test2", "AClass", "public boolean check() { return false; }");
assertTypeBodyProposal(
@@ -1698,7 +1698,7 @@ public class CodeCompletionTest extends CoreTests {
// propose methods invoked via a phantom role, simple case
public void testMethodInvocation1() throws CoreException {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" protected class R {\n" +
@@ -1707,8 +1707,8 @@ public class CodeCompletionTest extends CoreTests {
" }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testMethodInvocation1 extends SuperTeam {\n");
@@ -1716,8 +1716,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" r.\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testMethodInvocation1 extends SuperTeam {\n");
@@ -1725,13 +1725,13 @@ public class CodeCompletionTest extends CoreTests {
expectedContent.append(" r.foo();\n");
expectedContent.append(" }\n");
expectedContent.append("}");
-
+
String expectedInfo = ">Doc of foo() </body></html>";
String completeAfter = "r.";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("foo();")+6;
-
+
ICompletionProposal proposal = assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
assertTrue("Unexpected additional info", proposal.getAdditionalProposalInfo().endsWith(expectedInfo));
}
@@ -1739,7 +1739,7 @@ public class CodeCompletionTest extends CoreTests {
// propose methods invoked via a phantom role, two direct tsuper roles both have the method, pick the nearest version
public void testMethodInvocation2() throws CoreException {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" protected team class Mid1 {\n" +
@@ -1756,8 +1756,8 @@ public class CodeCompletionTest extends CoreTests {
" }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testMethodInvocation2 extends SuperTeam {\n");
@@ -1773,8 +1773,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" }\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testMethodInvocation2 extends SuperTeam {\n");
@@ -1790,7 +1790,7 @@ public class CodeCompletionTest extends CoreTests {
expectedContent.append(" }\n");
expectedContent.append(" }\n");
expectedContent.append("}");
-
+
String superMid1R = "%E2%98%82=OTTestProject1/src%3Ctest1.p1%7BSuperTeam.java%E2%98%83SuperTeam%E2%98%83Mid1%E2%98%83R";
String expectedInfo = ">foo in SuperMid2 " +
"<div><b>Overrides:</b> " +
@@ -1800,7 +1800,7 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "r.";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("r.foo();")+8;
-
+
ICompletionProposal proposal = assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
assertTrue("Unexpected additional info", proposal.getAdditionalProposalInfo().endsWith(expectedInfo));
}
@@ -1808,7 +1808,7 @@ public class CodeCompletionTest extends CoreTests {
// propose methods invoked via a phantom role, two direct tsuper roles, only more distant one has the method
public void testMethodInvocation3() throws CoreException {
IPackageFragment pkg = CompletionTestSetup.getTestPackage(this.fJProject1, "p1");
- pkg.createCompilationUnit("SuperTeam.java",
+ pkg.createCompilationUnit("SuperTeam.java",
"package test1.p1;\n" +
"public team class SuperTeam {\n" +
" protected team class Mid1 {\n" +
@@ -1823,8 +1823,8 @@ public class CodeCompletionTest extends CoreTests {
" }\n" +
"}\n",
true, null);
-
- StringBuffer subTeamContent = new StringBuffer();
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("import test1.p1.SuperTeam;\n");
subTeamContent.append("public team class Completion_testMethodInvocation3 extends SuperTeam {\n");
@@ -1840,8 +1840,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" }\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("import test1.p1.SuperTeam;\n");
expectedContent.append("public team class Completion_testMethodInvocation3 extends SuperTeam {\n");
@@ -1857,7 +1857,7 @@ public class CodeCompletionTest extends CoreTests {
expectedContent.append(" }\n");
expectedContent.append(" }\n");
expectedContent.append("}");
-
+
String superMid1R = "%E2%98%82=OTTestProject1/src%3Ctest1.p1%7BSuperTeam.java%E2%98%83SuperTeam%E2%98%83Mid1%E2%98%83R";
String expectedInfo = ">foo in SubMid1 " +
"<div><b>Overrides:</b> " +
@@ -1867,17 +1867,17 @@ public class CodeCompletionTest extends CoreTests {
String completeAfter = "r.";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("r.foo();")+8;
-
+
ICompletionProposal proposal = assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
assertTrue("Unexpected additional info", proposal.getAdditionalProposalInfo().endsWith(expectedInfo));
}
-
+
// propose methods invoked via a phantom role, simple nested case
public void testMethodInvocation4() throws CoreException {
-
-
- StringBuffer subTeamContent = new StringBuffer();
+
+
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("public team class Completion_testMethodInvocation4 {\n");
subTeamContent.append(" protected team class Mid1 {\n");
@@ -1893,8 +1893,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" }\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("public team class Completion_testMethodInvocation4 {\n");
expectedContent.append(" protected team class Mid1 {\n");
@@ -1910,23 +1910,23 @@ public class CodeCompletionTest extends CoreTests {
expectedContent.append(" }\n");
expectedContent.append(" }\n");
expectedContent.append("}");
-
+
String expectedInfo = ">foo in Mid1 </body></html>";
String completeAfter = "r.";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("r.foo();")+8;
-
+
ICompletionProposal proposal = assertProposal("foo", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
assertTrue("Unexpected additional info", proposal.getAdditionalProposalInfo().endsWith(expectedInfo));
}
// propose methods invoked via a phantom role, simple nested case
public void testMethodInvocation5() throws CoreException {
-
+
createBaseClass("test1", "B", "public boolean check() { return false; }");
- StringBuffer subTeamContent = new StringBuffer();
+ StringBuffer subTeamContent = new StringBuffer();
subTeamContent.append("package test1;\n");
subTeamContent.append("public team class Completion_testMethodInvocation5 {\n");
subTeamContent.append(" protected class R playedBy B {\n");
@@ -1938,8 +1938,8 @@ public class CodeCompletionTest extends CoreTests {
subTeamContent.append(" }\n");
subTeamContent.append(" }\n");
subTeamContent.append("}");
-
- StringBuffer expectedContent = new StringBuffer();
+
+ StringBuffer expectedContent = new StringBuffer();
expectedContent.append("package test1;\n");
expectedContent.append("public team class Completion_testMethodInvocation5 {\n");
expectedContent.append(" protected class R playedBy B {\n");
@@ -1951,12 +1951,12 @@ public class CodeCompletionTest extends CoreTests {
expectedContent.append(" }\n");
expectedContent.append(" }\n");
expectedContent.append("}");
-
+
String completeAfter = "roles.";
int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
int posAfter = expectedContent.indexOf("roles.add(arg0)")+10; // at start of argument
-
+
ICompletionProposal proposal = assertProposal("add", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 4), 0);
assertTrue("Should be a parameter guessing proposal", proposal instanceof ParameterGuessingProposal);
assertChoices(proposal, new String[][]{new String[]{"arg0", "rarg", "null"}}); // <- this is key: expect "rarg" next to "arg0"!
@@ -2000,25 +2000,25 @@ public class CodeCompletionTest extends CoreTests {
"}\n");
int posAfter = expectedContent.indexOf("new R()") + "new R()".length();
-
+
ICompletionProposal proposal = assertProposal("R()", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
assertTrue("Should be a java method proposal", proposal instanceof JavaMethodCompletionProposal);
}
// == Below: Helper methods/fields. ==
-
- private void createBaseClass(String classBody)
- throws JavaModelException, CoreException
+
+ private void createBaseClass(String classBody)
+ throws JavaModelException, CoreException
{
createBaseClass("test1", "B", classBody);
}
- private void createBaseClass(String basePackage, String className, String classBody)
- throws JavaModelException, CoreException
+ private void createBaseClass(String basePackage, String className, String classBody)
+ throws JavaModelException, CoreException
{
createBaseClass(basePackage, className, "", classBody);
}
- private void createBaseClass(String basePackage, String className, String classHeaderDetails, String classBody)
- throws JavaModelException, CoreException
+ private void createBaseClass(String basePackage, String className, String classHeaderDetails, String classBody)
+ throws JavaModelException, CoreException
{
// create a base class:
StringBuffer buf= new StringBuffer();
@@ -2044,7 +2044,7 @@ public class CodeCompletionTest extends CoreTests {
private String fLocals;
private char fTrigger;
private boolean fWaitBeforeCompleting;
-
+
protected void assertChoices(ICompletionProposal proposal, String[][] expected) {
assertTrue("Not a ParameterGuessingProposal", proposal instanceof ParameterGuessingProposal);
ParameterGuessingProposal pgProposal = (ParameterGuessingProposal)proposal;
@@ -2057,48 +2057,48 @@ public class CodeCompletionTest extends CoreTests {
}
}
}
-
- protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance)
- throws CoreException
+
+ protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance)
+ throws CoreException
{
return assertTypeBodyProposal(before, selector, expected, requiredRelevance, true);
}
- protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance, boolean addRole)
- throws CoreException
+ protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance, boolean addRole)
+ throws CoreException
{
StringBuffer contents= new StringBuffer();
IRegion preSelection= assembleClassBodyTestCUExtractSelection(contents, before, fBeforeImports, addRole);
StringBuffer result= new StringBuffer();
IRegion expectedSelection= assembleClassBodyTestCUExtractSelection(result, expected, fAfterImports, addRole);
-
+
return assertProposal(selector, null, null, contents, preSelection, result, expectedSelection, requiredRelevance);
}
- protected ICompletionProposal assertROFIBodyProposal(String before, String selector, String expected, int requiredRelevance)
- throws CoreException
+ protected ICompletionProposal assertROFIBodyProposal(String before, String selector, String expected, int requiredRelevance)
+ throws CoreException
{
IPackageFragment testPkg = CompletionTestSetup.getTestPackage(this.fJProject1, null);
String teamName = "Completion_" + getName();
- testPkg.createCompilationUnit(teamName + ".java",
+ testPkg.createCompilationUnit(teamName + ".java",
"package test1;\n" +
"/** @role RoFiRole */\n" +
- "public team class Completion_"+getName()+" {}\n",
+ "public team class Completion_"+getName()+" {}\n",
true, null);
-
+
StringBuffer contents= new StringBuffer();
IRegion preSelection= assembleROFIBodyTestCUExtractSelection(contents, before, fBeforeImports);
StringBuffer result= new StringBuffer();
IRegion expectedSelection= assembleROFIBodyTestCUExtractSelection(result, expected, fAfterImports);
-
+
return assertProposal(selector, teamName, "RoFiRole", contents, preSelection, result, expectedSelection, requiredRelevance);
}
- protected void assertNosuchTypeBodyProposal(String before, String selector, int requiredRelevance)
- throws CoreException
+ protected void assertNosuchTypeBodyProposal(String before, String selector, int requiredRelevance)
+ throws CoreException
{
StringBuffer contents= new StringBuffer();
IRegion preSelection= assembleClassBodyTestCUExtractSelection(contents, before, fBeforeImports, true);
-
+
assertNosuchProposal(selector, contents, preSelection, requiredRelevance);
}
@@ -2172,7 +2172,7 @@ public class CodeCompletionTest extends CoreTests {
private ICompletionProposal assertProposal(String selector, String relativePackage, String typeName, StringBuffer contents, IRegion preSelection, StringBuffer result, IRegion expectedSelection, int requiredRelevance) throws CoreException {
//{ObjectTeams: made package and file name configurable via new arguments `relativePackage'/`typeName':
IPackageFragment pkg = (relativePackage == null) ? CompletionTestSetup.getAnonymousTestPackage(this.fJProject1) : CompletionTestSetup.getTestPackage(this.fJProject1, relativePackage);
- fCU= (typeName == null) ? createCU(pkg, contents.toString()) : pkg.createCompilationUnit(typeName + ".java", contents.toString(), false, null);
+ fCU= (typeName == null) ? createCU(pkg, contents.toString()) : pkg.createCompilationUnit(typeName + ".java", contents.toString(), false, null);
// SH}
fEditor= (JavaEditor) EditorUtility.openInEditor(fCU);
IDocument doc;
@@ -2197,8 +2197,8 @@ public class CodeCompletionTest extends CoreTests {
return proposal;
}
- private void assertNosuchProposal(String selector, StringBuffer contents, IRegion preSelection, int requiredRelevance)
- throws CoreException
+ private void assertNosuchProposal(String selector, StringBuffer contents, IRegion preSelection, int requiredRelevance)
+ throws CoreException
{
fCU= createCU(CompletionTestSetup.getAnonymousTestPackage(this.fJProject1), contents.toString());
fEditor= (JavaEditor) EditorUtility.openInEditor(fCU);
@@ -2209,7 +2209,7 @@ public class CodeCompletionTest extends CoreTests {
closeEditor(fEditor);
}
}
-
+
// from 3.4 CodeCompletionTest
private void assertAppliedProposal(String contents, IJavaCompletionProposal proposal, String completion) {
IDocument doc= new Document(contents);
@@ -2238,10 +2238,10 @@ public class CodeCompletionTest extends CoreTests {
private ICompletionProposal findNamedProposal(String prefix, ICompilationUnit cu, IRegion selection, int requiredRelevance) throws JavaModelException, PartInitException {
ICompletionProposal[] proposals= collectProposals(cu, selection);
-
+
ICompletionProposal found= null;
for (int i= 0; i < proposals.length; i++) {
- if (proposals[i] instanceof IJavaCompletionProposal)
+ if (proposals[i] instanceof IJavaCompletionProposal)
if (((IJavaCompletionProposal)proposals[i]).getRelevance() < requiredRelevance)
continue;
String displayString= proposals[i].getDisplayString();
@@ -2267,7 +2267,7 @@ public class CodeCompletionTest extends CoreTests {
* Invokes {@link Thread#sleep(long)} if {@link #waitBeforeCompleting(boolean)} was set to
* <code>true</code> or camel case completions are enabled. For some reasons, inner types and
* camel case matches don't show up otherwise.
- *
+ *
* @since 3.2
*/
private void waitBeforeCoreCompletion() {
@@ -2299,5 +2299,5 @@ public class CodeCompletionTest extends CoreTests {
} else {
proposal.apply(doc);
}
- }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java
index bb043cf49..a1e8df206 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.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
@@ -48,28 +48,28 @@ class CompletionTestSetup extends ProjectTestSetup {
IPackageFragmentRoot root= project.getPackageFragmentRoot("src");
if (!root.exists())
root= JavaProjectHelper.addSourceContainer(project, "src");
-
+
IPackageFragment fragment= root.getPackageFragment(packageName);
if (!fragment.exists())
fragment= root.createPackageFragment(packageName, false, null);
-
+
return fragment;
}
-
+
private static int fAnonymousSoureFolderCounter= 0;
public static IPackageFragment getAnonymousTestPackage(IJavaProject project) throws CoreException {
String sourceFolder= "src" + fAnonymousSoureFolderCounter++;
IPackageFragmentRoot root= project.getPackageFragmentRoot(sourceFolder);
if (!root.exists())
root= JavaProjectHelper.addSourceContainer(project, sourceFolder);
-
+
IPackageFragment fragment= root.getPackageFragment("test1");
if (!fragment.exists())
fragment= root.createPackageFragment("test1", false, null);
-
+
return fragment;
}
-
+
public CompletionTestSetup(Test test) {
super(test);
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/HierarchicalASTVisiting.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/HierarchicalASTVisiting.java
index 814aac6f6..44cb59d7b 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/HierarchicalASTVisiting.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/HierarchicalASTVisiting.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
**********************************************************************/
@@ -41,7 +41,7 @@ import base org.eclipse.jdt.ui.tests.core.HierarchicalASTVisitorTest;
/**
* This team excludes OT-specific AST nodes from HierarchicalASTVisitorTest
- * because the HierarchicalASTVisitor is not OT-aware.
+ * because the HierarchicalASTVisitor is not OT-aware.
*/
public team class HierarchicalASTVisiting {
@@ -53,8 +53,8 @@ public team class HierarchicalASTVisiting {
static callin boolean isVisitMethod(Method method) {
return base.isVisitMethod(method) && !isOTNode(method.getParameterTypes()[0]);
}
-
-
+
+
private static boolean isOTNode(Class nodeClass) {
Class[] otNodeClasses = new Class[] {
MethodSpec.class,
@@ -74,7 +74,7 @@ public team class HierarchicalASTVisiting {
PrecedenceDeclaration.class,
GuardPredicateDeclaration.class
};
- for (int i = 0; i < otNodeClasses.length; i++)
+ for (int i = 0; i < otNodeClasses.length; i++)
if (otNodeClasses[i] == nodeClass)
return true;
return false;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/JavaQuickFixTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/JavaQuickFixTests.java
index 0b8b2796d..ab1ec54ba 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/JavaQuickFixTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/JavaQuickFixTests.java
@@ -1,17 +1,17 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2010, 2016 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
**********************************************************************/
@@ -51,7 +51,7 @@ import org.osgi.framework.Bundle;
/**
* Testing whether standard Java quickfixes work in OT/J code, too.
- *
+ *
* @author stephan
* @since 0.7.0
*/
@@ -65,7 +65,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
void setupForNullAnnotations(boolean isPlainJava) throws IOException, JavaModelException {
if (this.ANNOTATION_JAR_PATH == null) {
- String version= "[2.0.0,3.0.0)";
+ String version= "[2.0.0,3.0.0)";
Bundle[] bundles= Platform.getBundles("org.eclipse.jdt.annotation", version);
File bundleFile= FileLocator.getBundleFile(bundles[0]);
if (bundleFile.isDirectory())
@@ -74,9 +74,9 @@ public class JavaQuickFixTests extends OTQuickFixTest {
this.ANNOTATION_JAR_PATH= bundleFile.getPath();
}
JavaProjectHelper.addLibrary(fJProject1, new Path(ANNOTATION_JAR_PATH));
-
+
Hashtable<String, String> options= TestOptions.getDefaultOptions();
-
+
options.put(OTDTPlugin.OT_COMPILER_PURE_JAVA, isPlainJava ? JavaCore.ENABLED : JavaCore.DISABLED);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
@@ -98,7 +98,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
}
// the following three test try to reproduce Bug 311890 - [assist] support "create class" quickfix for OT/J references
-
+
// create a class for an unresolved playedBy declaration
@Test
public void testCreateClass1() throws Exception {
@@ -110,7 +110,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 6);
@@ -129,7 +129,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
}
fail("Expected proposal not found");
}
-
+
// create a class for an unresolved playedBy declaration in a nested role
@Test
public void testCreateClass2() throws Exception {
@@ -143,7 +143,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 7);
@@ -176,7 +176,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" public void foo(B as R o) {}\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot, 2, 1, null);
assertNumberOfProposals(proposals, 5);
@@ -195,7 +195,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
}
fail("Expected proposal not found");
}
-
+
// Bug 348574 - [quickfix] implement abstract methods from tsuper
@Test
public void testAddAbstractMethods1() throws CoreException {
@@ -216,7 +216,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu1);
ArrayList<IJavaCompletionProposal> proposals1= collectCorrections(cu1, astRoot, 2, 0);
assertNumberOfProposals(proposals1, 0);
@@ -234,12 +234,12 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append("\n");
buf.append(" @Override\n");
buf.append(" void foo() {\n");
- buf.append(" // TODO Auto-generated method stub\n");
+ buf.append(" // TODO Auto-generated method stub\n");
buf.append(" \n");
buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
- String expected1= buf.toString();
+ String expected1= buf.toString();
proposal= (CUCorrectionProposal) proposals2.get(1);
@@ -251,9 +251,9 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" protected abstract class R {\n");
buf.append(" }\n");
buf.append("}\n");
- String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
// Bug 348574 - [quickfix] implement abstract methods from tsuper
@@ -277,7 +277,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu1);
ArrayList<IJavaCompletionProposal> proposals1= collectCorrections(cu1, astRoot, 2, 0);
assertNumberOfProposals(proposals1, 0);
@@ -295,12 +295,12 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append("\n");
buf.append(" @Override\n");
buf.append(" static void foo() {\n");
- buf.append(" // TODO Auto-generated method stub\n");
+ buf.append(" // TODO Auto-generated method stub\n");
buf.append(" \n");
buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
- String expected1= buf.toString();
+ String expected1= buf.toString();
proposal= (CUCorrectionProposal) proposals2.get(1);
@@ -312,15 +312,15 @@ public class JavaQuickFixTests extends OTQuickFixTest {
buf.append(" protected abstract class R {\n");
buf.append(" }\n");
buf.append("}\n");
- String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
@Test
public void testExtractPotentiallyNullField1() throws Exception {
setupForNullAnnotations(true/*plainJava*/);
-
+
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
@@ -374,7 +374,7 @@ public class JavaQuickFixTests extends OTQuickFixTest {
// secondary
ChangeCorrectionProposal otherProposal = (ChangeCorrectionProposal) proposals.get(1);
assertEquals("Display String 2", "Add @SuppressWarnings 'null' to 'foo()'", otherProposal.getDisplayString());
-
+
otherProposal = (ChangeCorrectionProposal) proposals.get(2);
assertEquals("Display String 3", "Configure problem severity", otherProposal.getDisplayString());
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java
index 00b590246..85d06e734 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.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
* Technical University Berlin - Initial API and implementation
@@ -34,7 +34,7 @@ import org.junit.runners.JUnit4;
// structure OT_COPY_PASTE from {@link org.eclipse.jdt.ui.tests.quickfix.ModifierCorrectionsQuickFixTest}
@RunWith(JUnit4.class)
public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
-
+
@Rule
public ProjectTestSetup projectsetup = new ProjectTestSetup();
@@ -43,7 +43,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
public void testRoleCtorCalled1() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" R(){}\n");
@@ -54,17 +54,17 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" protected R(){}\n");
@@ -81,7 +81,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
public void testRoleCtorCalled2() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" R(){}\n");
@@ -94,17 +94,17 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" protected R(){}\n");
@@ -117,21 +117,21 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
/* calling a non-public role constructor from a sibling role file. */
@Test
public void testRoleCtorCalled3() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
IPackageFragment pack1T= fSourceFolder.createPackageFragment("test1.T", false, null);
StringBuffer buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" R(){}\n");
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
buf.append("team package test1.T;\n");
buf.append("protected class R2 {\n");
@@ -141,17 +141,17 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" protected R(){}\n");
@@ -171,9 +171,9 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append(" R2(){}\n");
buf.append("}\n");
pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" protected class R {\n");
buf.append(" void foo() {\n");
@@ -183,12 +183,12 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
@@ -199,20 +199,20 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
/* calling a non-public role constructor as externalized. */
@Test
public void testRoleCtorCalled5() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" public class R {\n");
buf.append(" R(){}\n");
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class Main {\n");
@@ -222,17 +222,17 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("Main.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot, 2, null);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" public class R {\n");
buf.append(" public R(){}\n");
@@ -240,20 +240,20 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
/* calling a non-public role method on externalized. */
@Test
public void testRoleMethodCalled() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" public class R {\n");
buf.append(" void bar(){}\n");
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class Main {\n");
@@ -263,17 +263,17 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("Main.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T {\n");
buf.append(" public class R {\n");
buf.append(" public void bar(){}\n");
@@ -281,7 +281,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
@Test
public void testCalloutToPrivate() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
@@ -291,7 +291,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append(" private int foo() { return 0; }\n");
buf.append("}\n");
pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class TeamFoo {\n");
@@ -305,12 +305,12 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
@@ -328,8 +328,8 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
-
+
+
@Test
public void testCalloutViaExternalized() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
@@ -339,7 +339,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append(" int foo() { return 0; }\n");
buf.append("}\n");
pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
-
+
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class TeamFoo {\n");
@@ -352,12 +352,12 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
@@ -373,7 +373,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
/** @SuppressWarnings("bindingconventions") was added a wrong location. */
@Test
public void testSuppressWarnings1() throws Exception {
@@ -384,7 +384,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append(" int foo() { return 0; }\n");
buf.append("}\n");
pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
-
+
IPackageFragment pack2 = fSourceFolder.createPackageFragment("test2", false, null);
buf = new StringBuffer();
buf.append("package test2;\n");
@@ -395,12 +395,12 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
ICompilationUnit cu= pack2.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 3);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= getPreviewContent(proposal);
@@ -413,7 +413,7 @@ public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
-
+
assertEqualString("Configure problem severity", proposals.get(1).getDisplayString());
assertEqualString("\"Change import to 'import base test1...BaseBar;'\"", proposals.get(2).getDisplayString());
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java
index 61809d1bf..b7163ddbd 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.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
@@ -65,7 +65,7 @@ public class OTJavadocQuickFixTest extends OTQuickFixTest {
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaCore.ERROR);
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING, JavaCore.ENABLED);
- JavaCore.setOptions(options);
+ JavaCore.setOptions(options);
StringBuffer comment= new StringBuffer();
comment.append("/**\n");
@@ -76,7 +76,7 @@ public class OTJavadocQuickFixTest extends OTQuickFixTest {
StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID, res, null);
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODCOMMENT_ID, res, null);
StubUtility.setCodeTemplate(CodeTemplateContextType.TYPECOMMENT_ID, res, null);
-
+
comment= new StringBuffer();
comment.append("/**\n");
comment.append(" * A field comment for ${field}.\n");
@@ -89,29 +89,29 @@ public class OTJavadocQuickFixTest extends OTQuickFixTest {
comment.append(" * ${see_to_overridden}\n");
comment.append(" */");
StubUtility.setCodeTemplate(CodeTemplateContextType.OVERRIDECOMMENT_ID, comment.toString(), null);
-
+
comment= new StringBuffer();
comment.append("/**\n");
comment.append(" * A delegate comment.\n");
comment.append(" * ${see_to_target}\n");
comment.append(" */");
StubUtility.setCodeTemplate(CodeTemplateContextType.DELEGATECOMMENT_ID, comment.toString(), null);
-
+
fJProject1= ProjectTestSetup.getProject();
fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
-
+
//{ObjectTeams: add the OTRE:
JavaProjectHelper.addLibrary(fJProject1, new Path(OTRE_JAR_PATH));
// SH}
}
-
+
@Test
public void testMissingRoleTag1() throws Exception {
IPackageFragment teamPkg = fSourceFolder.createPackageFragment("test1.MyTeam", false, null);
- teamPkg.createCompilationUnit("MyRole.java",
+ teamPkg.createCompilationUnit("MyRole.java",
"team package test1.MyTeam;\n" +
- "public class MyRole {}\n",
+ "public class MyRole {}\n",
true, null);
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@@ -123,15 +123,15 @@ public class OTJavadocQuickFixTest extends OTQuickFixTest {
buf.append(" private MyRole r = null;\n"); // use field to trigger loading of role file
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("MyTeam.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot, 1);
assertNumberOfProposals(proposals, 2);
assertCorrectLabels(proposals);
-
+
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(1);
String preview1= getPreviewContent(proposal);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("/**\n");
@@ -142,7 +142,7 @@ public class OTJavadocQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
String expected= buf.toString();
assertEqualString(preview1, expected);
-
+
assertEqualString("Configure problem severity", proposals.get(0).getDisplayString());
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java
index e3a94889d..51a8574fc 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.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
@@ -64,34 +64,34 @@ import org.junit.runners.Suite;
public class OTQuickFixTest extends QuickFixTest {
protected IJavaProject fJProject1;
-
+
protected IPackageFragmentRoot fSourceFolder;
public static final String OT_RUNTIME_PATH;
public static final String OTRE_JAR_PATH;
static {
OT_RUNTIME_PATH = JavaCore.getClasspathVariable(OTDTPlugin.OTDT_INSTALLDIR).toOSString();
- OTRE_JAR_PATH = OT_RUNTIME_PATH
+ OTRE_JAR_PATH = OT_RUNTIME_PATH
+ File.separator
+ "lib" //$NON-NLS-1$
+ File.separator
+ "otre.jar"; //$NON-NLS-1$
}
-
+
@SuppressWarnings("unchecked")
protected void addOptions(Hashtable options) {
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
}
@Before
public void setUp() throws Exception {
Hashtable<String,String> options= TestOptions.getDefaultOptions();
addOptions(options);
-
- JavaCore.setOptions(options);
-
+
+ JavaCore.setOptions(options);
+
fJProject1= ProjectTestSetup.getProject();
if (!OTJavaNature.hasOTJavaNature(fJProject1.getProject())) {
IProjectDescription description = fJProject1.getProject().getDescription();
@@ -99,7 +99,7 @@ public class OTQuickFixTest extends QuickFixTest {
fJProject1.getProject().setDescription(description, null);
OTREContainer.initializeOTJProject(fJProject1.getProject());
}
-
+
fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
@@ -107,11 +107,11 @@ public class OTQuickFixTest extends QuickFixTest {
public void tearDown() throws Exception {
JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath());
}
-
+
protected void assertChoices(ICompletionProposal proposal, String linkedGroup, String[] expected) {
assertTrue("Not a LinkedCorrectionProposal", proposal instanceof LinkedCorrectionProposal);
LinkedCorrectionProposal linkedProposal = (LinkedCorrectionProposal)proposal;
-
+
LinkedProposalModel linkedProposalModel = new ProposalAdaptor().getLinkedProposalModel(linkedProposal);
LinkedProposalPositionGroup positionGroup = linkedProposalModel.getPositionGroup(linkedGroup, false);
Proposal[] choices = positionGroup.getProposals();
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java
index 19da63078..0ed20842f 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.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
@@ -58,7 +58,7 @@ import org.osgi.service.prefs.BackingStoreException;
* <code>org.eclipse.jdt.ui.tests.core.ImportOrganizeTest</code> in the test suite
* <code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse as
* well as new OT-specific tests.
- *
+ *
* @author brcan
*/
@RunWith(JUnit4.class)
@@ -131,7 +131,7 @@ public class OrganizeImportsTest
}
};
}
-
+
public static void assertEqualString(String actual, String expected)
{
StringAsserts.assertEqualString(actual, expected);
@@ -438,7 +438,7 @@ public class OrganizeImportsTest
null);
buf = new StringBuffer();
buf.append("package teamPkg;\n");
- buf.append("import base basePkg.B1;\n");
+ buf.append("import base basePkg.B1;\n");
buf.append("import base basePkg.B1.Inner;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class Inner playedBy Inner {\n");
@@ -462,7 +462,7 @@ public class OrganizeImportsTest
buf = new StringBuffer();
buf.append("package teamPkg;\n");
- buf.append("import base basePkg.B1;\n");
+ buf.append("import base basePkg.B1;\n");
buf.append("import base basePkg.B1.Inner;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class Inner playedBy Inner {\n");
@@ -473,7 +473,7 @@ public class OrganizeImportsTest
buf.append("}\n");
assertEqualString(cu.getSource(), buf.toString());
}
-
+
// base import for role file
@Test
public void testTypeReferenceInRoleclass7() throws Exception
@@ -673,7 +673,7 @@ public class OrganizeImportsTest
buf.append(" private static void testB1() { }");
buf.append("}\n");
basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
-
+
IPackageFragment teamPkg = sourceFolder.createPackageFragment(
"teamPkg",
false,
@@ -725,7 +725,7 @@ public class OrganizeImportsTest
buf.append(" void testB1() { }");
buf.append("}\n");
basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
-
+
IPackageFragment teamPkg = sourceFolder.createPackageFragment(
"teamPkg",
false,
@@ -785,7 +785,7 @@ public class OrganizeImportsTest
buf.append("public class B1 {\n");
buf.append("}\n");
basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
-
+
IPackageFragment teamPkg = sourceFolder.createPackageFragment(
"teamPkg",
false,
@@ -841,7 +841,7 @@ public class OrganizeImportsTest
buf.append(" }\n");
buf.append("}\n");
basePkg.createCompilationUnit("BaseTeam.java", buf.toString(), false, null);
-
+
IPackageFragment teamPkg = sourceFolder.createPackageFragment(
"teamPkg",
false,
@@ -855,17 +855,17 @@ public class OrganizeImportsTest
buf.append("}\n");
ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
.toString(), false, null);
-
+
String[] order = new String[0];
IChooseImportQuery query = createQuery(
"T1",
new String[] {},
new int[] {});
-
+
OrganizeImportsOperation op = createOperation(cu, order,
99, false, true, true, query);
op.run(null);
-
+
buf = new StringBuffer();
buf.append("package teamPkg;\n");
buf.append("import basePkg.BaseTeam;\n");
@@ -892,7 +892,7 @@ public class OrganizeImportsTest
buf.append(" void m() {}\n");
buf.append("}\n");
basePkg.createCompilationUnit("Base.java", buf.toString(), false, null);
-
+
IPackageFragment teamPkg = sourceFolder.createPackageFragment(
"teamPkg",
false,
@@ -912,26 +912,26 @@ public class OrganizeImportsTest
buf.append("}\n");
ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
.toString(), false, null);
-
+
String[] order = new String[0];
IChooseImportQuery query = createQuery(
"T1",
new String[] {},
new int[] {});
-
+
OrganizeImportsOperation op = createOperation(cu, order,
99, false, true, true, query);
op.run(null);
-
+
// buf remains unchanged
assertEqualString(cu.getSource(), buf.toString());
}
-
+
private OrganizeImportsOperation createOperation(ICompilationUnit cu, String[] order, int threshold, boolean ignoreLowerCaseNames, boolean save, boolean doResolve, IChooseImportQuery chooseImportQuery) throws CoreException, BackingStoreException {
setOrganizeImportSettings(order, threshold, threshold, cu.getJavaProject());
return new OrganizeImportsOperation(cu, null, ignoreLowerCaseNames, save, doResolve, chooseImportQuery);
}
-
+
private void setOrganizeImportSettings(String[] order, int threshold, int staticThreshold, IJavaProject project) throws BackingStoreException {
IEclipsePreferences scope= new ProjectScope(project.getProject()).getNode(JavaUI.ID_PLUGIN);
if (order == null) {
@@ -947,5 +947,5 @@ public class OrganizeImportsTest
scope.put(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, String.valueOf(threshold));
}
}
-
+
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/PrecedenceQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/PrecedenceQuickFixTest.java
index 514c0420f..11fbe797b 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/PrecedenceQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/PrecedenceQuickFixTest.java
@@ -1,8 +1,8 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2010 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
@@ -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
**********************************************************************/
@@ -67,7 +67,7 @@ public class PrecedenceQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -90,7 +90,7 @@ public class PrecedenceQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
// QuickFix adds a binding-level "precedence after" declaration
@Test
public void testAddAfterBindingPrecedence() throws Exception {
@@ -114,7 +114,7 @@ public class PrecedenceQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -137,7 +137,7 @@ public class PrecedenceQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
// QuickFix adds a role-level precedence declaration
@Test
public void testAddAfterRolePrecedence() throws Exception {
@@ -163,7 +163,7 @@ public class PrecedenceQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java
index 3f44be0d2..64dd94bdc 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.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
* Fraunhofer FIRST - extended API and implementation
@@ -76,12 +76,12 @@ public class ProjectTestSetup extends TestSetup {
fAutobuilding = CoreUtility.setAutoBuilding(false);
//{ObjectTeams: create an OT project and keep otre.jar (don't overwrite with setRawClasspath)
-/* orig:
+/* orig:
fJProject= JavaProjectHelper.createJavaProject(PROJECT_NAME, "bin");
fJProject.setRawClasspath(getDefaultClasspath(), null);
:giro */
fJProject = org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper.createOTJavaProject(PROJECT_NAME, "bin");
- JavaProjectHelper.addRTJar(fJProject);
+ JavaProjectHelper.addRTJar(fJProject);
//gbr}
TestOptions.initializeProjectOptions(fJProject);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java
index 661b4ad0c..b0bef3750 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.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
@@ -34,7 +34,7 @@ public team class ProposalAdaptor {
@SuppressWarnings("decapsulation")
protected ICompletionProposal[][] getFChoices() -> get ICompletionProposal[][] fChoices;
-
+
}
/** API */
public ICompletionProposal[][] getChoices(ParameterGuessingProposal as GuessingProposal proposal) {
@@ -45,7 +45,7 @@ public team class ProposalAdaptor {
protected class LinkedCorrectionProposal playedBy LinkedCorrectionProposal {
@SuppressWarnings("decapsulation")
LinkedProposalModel getLinkedProposalModel() -> LinkedProposalModel getLinkedProposalModel();
- }
+ }
/** API */
public LinkedProposalModel getLinkedProposalModel(LinkedCorrectionProposal as LinkedCorrectionProposal proposal) {
return proposal.getLinkedProposalModel();
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StatementQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StatementQuickFixTest.java
index a714f8efd..52a274b3d 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StatementQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StatementQuickFixTest.java
@@ -1,8 +1,8 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
- *
+ *
* Copyright 2010 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
@@ -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
**********************************************************************/
@@ -32,10 +32,10 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class StatementQuickFixTest extends OTQuickFixTest {
-
+
@Rule
public ProjectTestSetup projectsetup = new ProjectTestSetup();
-
+
/* add a return statement to a role method (callin).
* See https://bugs.eclipse.org/311339
*/
@@ -51,7 +51,7 @@ public class StatementQuickFixTest extends OTQuickFixTest {
pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
buf = new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\")\n");
@@ -60,7 +60,7 @@ public class StatementQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cuteam);
ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cuteam, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -68,7 +68,7 @@ public class StatementQuickFixTest extends OTQuickFixTest {
String[] expectedProposals = new String[2];
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\")\n");
@@ -79,7 +79,7 @@ public class StatementQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
expectedProposals[0] = buf.toString();
buf= new StringBuffer();
- buf.append("package test1;\n");
+ buf.append("package test1;\n");
buf.append("public team class T1 {\n");
buf.append(" protected class R playedBy B1 {\n");
buf.append(" @SuppressWarnings(\"basecall\")\n");
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java
index 491d7c478..ba76315f9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java
index 47996f090..12f92d417 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.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
@@ -55,7 +55,7 @@ import org.junit.runners.JUnit4;
*/
@RunWith(JUnit4.class)
public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
-
+
@Rule
public ProjectTestSetup projectsetup = new ProjectTestSetup();
@@ -83,7 +83,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -103,11 +103,11 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" private int goo(Vector vec, boolean b) {\n");
buf.append(" return 0;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
-
+
proposal= (CUCorrectionProposal) proposals.get(1);
preview= getPreviewContent(proposal);
@@ -123,7 +123,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" public int goo(Vector vec, boolean b) {\n");
buf.append(" return 0;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
@@ -142,14 +142,14 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("team package test1.T;\n");
buf.append("public class R2 {\n");
buf.append("}\n");
IPackageFragment pack1T= fSourceFolder.createPackageFragment("test1.T", false, null);
pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2); // 2nd proposal not really useful (cast to Object??)
@@ -167,11 +167,11 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" public int goo(Vector vec, boolean b) {\n");
buf.append(" return 0;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
/* See Trac #12 */
@Test
public void testMethodInDifferentClass2() throws Exception {
@@ -183,7 +183,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.util.Vector;\n");
@@ -195,7 +195,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T2.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2); // 2nd proposal not really useful (cast to Object??)
@@ -214,12 +214,12 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" public int goo(Vector vec, boolean b) {\n");
buf.append(" return 0;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
@Test
public void testTSuperConstructor() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@@ -241,7 +241,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu1);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu1, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -256,10 +256,10 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" protected class R {\n");
buf.append("\n");
buf.append(" public R(int i) {\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
- String expected1= buf.toString();
+ String expected1= buf.toString();
proposal= (CUCorrectionProposal) proposals.get(1);
String preview2= getPreviewContent(proposal);
@@ -273,12 +273,12 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
- String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
-
+
// static callin method created
@Test
public void testCallinMethod1() throws Exception {
@@ -290,7 +290,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -299,7 +299,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2); // don't propose to generate into team!!
@@ -316,11 +316,11 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" void voo(int j) <- replace void foo(int i);\n");
buf.append("\n");
buf.append(" static callin void voo(int j) {\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
String expected1= buf.toString();
-
+
// remove signatures in callin binding voo<-foo
proposal= (CUCorrectionProposal) proposals.get(1);
String preview2= getPreviewContent(proposal);
@@ -333,8 +333,8 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
// non-static callin method created
@Test
@@ -347,7 +347,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -356,7 +356,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2); // don't propose to generate into team!!
@@ -374,7 +374,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" callin String voo(int j, Boolean b) {\n");
buf.append(" return null;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
String expected1= buf.toString();
@@ -391,8 +391,8 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
// non-static non-callin method created (base side)
@@ -405,7 +405,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("public class B {\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -413,11 +413,11 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" String voo(int j, Boolean b) <- replace String foo(int i, Boolean b);\n");
buf.append(" callin String voo(int j, Boolean b) {\n");
buf.append(" return base.voo(j, b);\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 2);
@@ -436,7 +436,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
String expected1 = buf.toString();
-
+
// remove signatures from callin voo<-foo
proposal= (CUCorrectionProposal) proposals.get(1);
String preview2= getPreviewContent(proposal);
@@ -448,12 +448,12 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" voo <- replace foo;\n");
buf.append(" callin String voo(int j, Boolean b) {\n");
buf.append(" return base.voo(j, b);\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
// Bug 329988 - Quickfix method generation on missing replace callin method generates wrong method
// callin method created from short callin binding -> need to infer method signature
@@ -467,7 +467,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -476,7 +476,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1); // don't propose to generate into team!!
@@ -493,7 +493,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" callin String voo(int i, Boolean boolean1) {\n");
buf.append(" return null;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
@@ -509,7 +509,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("public class B {\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -517,11 +517,11 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" voo <- replace foo;\n");
buf.append(" callin String voo(int j, Boolean flag) {\n");
buf.append(" return base.voo(j, flag);\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -554,7 +554,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -564,7 +564,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" public class R2 playedBy B {}\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1); // don't propose to generate into team!!
@@ -581,12 +581,12 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("\n");
buf.append(" callin R1 voo(int i, R1 r1) {\n");
buf.append(" return null;\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append(" }\n");
buf.append(" public class R2 playedBy B {}\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
-
+
LinkedProposalModel linkedProposalModel = new ProposalAdaptor().getLinkedProposalModel(proposal);
assertLinkedTypeProposals(linkedProposalModel, "arg_type_1", new String[]{"R1", "R2", "B"});
assertLinkedTypeProposals(linkedProposalModel, "type", new String[]{"R1", "R2", "B"});
@@ -613,7 +613,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("public class B {\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -623,7 +623,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -643,7 +643,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
-
+
// Bug 329988 - Quickfix method generation on missing replace callin method generates wrong method
// missing base method created (short callout binding) - translation involved
@@ -655,7 +655,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("public class B {\n");
buf.append("}\n");
pack1.createCompilationUnit("B.java", buf.toString(), false, null);
-
+
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public team class T1 {\n");
@@ -665,7 +665,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu);
ArrayList<? extends ICompletionProposal> proposals= collectCorrections(cu, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -721,7 +721,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" A a= new A(i);\n");
buf.append(" }\n");
buf.append("}\n");
- String expected1= buf.toString();
+ String expected1= buf.toString();
proposal= (CUCorrectionProposal) proposals.get(1);
String preview2= getPreviewContent(proposal);
@@ -735,14 +735,14 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" A a= new A();\n");
buf.append(" }\n");
buf.append("}\n");
- String expected2= buf.toString();
-
- assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
/* some orig tests for use in OT-variants:
- *
-
+ *
+
@Test
public void testConstructorInvocation() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@@ -754,7 +754,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu1=pack1.createCompilationUnit("E.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu1);
ArrayList proposals= collectCorrections(cu1, astRoot);
assertNumberOfProposals(proposals, 1);
@@ -771,14 +771,14 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append(" }\n");
buf.append("\n");
buf.append(" public E(int i, boolean b) {\n");
- buf.append(" }\n");
+ buf.append(" }\n");
buf.append("}\n");
String expected1= buf.toString();
-
+
assertEqualString(preview1, expected1);
}
-
-
+
+
@Test
public void testSuperMethodInvocation() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@@ -796,7 +796,7 @@ public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
buf.append("public class A {\n");
buf.append("}\n");
pack1.createCompilationUnit("A.java", buf.toString(), false, null);
-
+
CompilationUnit astRoot= getASTRoot(cu1);
ArrayList proposals= collectCorrections(cu1, astRoot);
assertNumberOfProposals(proposals, 1);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/rule/ProjectTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/rule/ProjectTestSetup.java
index fada31e4b..9cc6e95fa 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/rule/ProjectTestSetup.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/rule/ProjectTestSetup.java
@@ -84,7 +84,7 @@ public class ProjectTestSetup extends ExternalResource {
javaProject.setRawClasspath(getDefaultClasspath(), null);
:giro */
IJavaProject javaProject= org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper.createOTJavaProject(PROJECT_NAME, "bin");
- JavaProjectHelper.addRTJar(javaProject);
+ JavaProjectHelper.addRTJar(javaProject);
//gbr}
TestOptions.initializeProjectOptions(javaProject);
return javaProject;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java
index 5e3f11acf..938f248a1 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java
index 9d0dcf06b..cc245a27f 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java
index 7d7393d2f..6ffed618a 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
index 1d17f277f..f43138ec1 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.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
@@ -44,10 +44,10 @@ import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
public class OTSubHierarchyContentProviderTests extends FileBasedUITest
{
private static final String FAKED_PLUGIN_ID = "org.eclipse.objectteams.otdt.tests";
-
+
private static final String PROJECT_DIR = "Hierarchy";
private static final String SRC_FOLDER = "src";
-
+
private SubTypeHierarchyViewer.SubTypeHierarchyContentProvider _testObject;
//call doHierarchyRefresh(IJavaElement element, null) on _lifeCycle
//to create a hierarchy on element.
@@ -61,34 +61,34 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
private IType _T6;
private IType _T7;
private IType _T8;
-
+
private IType _T1_R1;
// private IType _T1_R2; not within the cone of types reachable from _T1_R1
-
+
private IType _T2_R1;
private IType _T2_R2;
-
+
private IType _T3_R1;
private IType _T3_R2;
-
+
private IType _T4_R2;
-
+
private IType _T5_R1;
private IType _T5_R2;
private IType _T5_R3;
-
+
private IType _T6_R1;
-
+
private IType _T7_R2;
private IType _T7_R3;
-
+
private IType _T8_R2;
-
+
private IType _objectType;
private IType[] _allTypesInProject;
-
+
public OTSubHierarchyContentProviderTests(String name)
{
super(name);
@@ -96,11 +96,11 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
protected String getPluginID()
{
- //overwrites the ID because tests are using the
+ //overwrites the ID because tests are using the
//workspace of org.eclipse.objectteams.otdt.tests
return FAKED_PLUGIN_ID;
}
-
+
public static Test suite()
{
if (true)
@@ -111,66 +111,66 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir(PROJECT_DIR);
-
+
super.setUpSuite();
waitUntilIndexesReady();
-
+
String pkg = "test001";
- _T1 =
+ _T1 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1");
-
- _T2 =
+
+ _T2 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2");
- _T3 =
+ _T3 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3");
-
- _T4 =
+
+ _T4 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4");
- _T5 =
+ _T5 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5");
- _T6 =
+ _T6 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6");
-
- _T7 =
+
+ _T7 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7");
- _T8 =
+ _T8 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8");
-
+
_T1_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
@@ -184,90 +184,90 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
pkg,
"T2",
"R1").getCorrespondingJavaElement();
-
+
_T2_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2",
"R2").getCorrespondingJavaElement();
-
+
_T3_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R1").getCorrespondingJavaElement();
-
+
_T3_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R2").getCorrespondingJavaElement();
-
+
_T4_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4",
"R2").getCorrespondingJavaElement();
-
+
_T5_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R1").getCorrespondingJavaElement();
-
+
_T5_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R2").getCorrespondingJavaElement();
-
+
_T5_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R3").getCorrespondingJavaElement();
-
+
_T6_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6",
"R1").getCorrespondingJavaElement();
-
+
_T7_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R2").getCorrespondingJavaElement();
-
+
_T7_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R3").getCorrespondingJavaElement();
-
+
_T8_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8",
"R2").getCorrespondingJavaElement();
-
+
_objectType = getType(getTestProjectDir(), "rt.jar", "java.lang", "Object");
-
+
_allTypesInProject = new IType[]
{
_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
- _T1_R1, //_T1_R2,
+ _T1_R1, //_T1_R2,
_T2_R1, _T2_R2,
_T3_R1, _T3_R2,
_T4_R2,
@@ -277,7 +277,7 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
_T8_R2
};
_lifeCycle = new TypeHierarchyLifeCycle(false);
- _testObject =
+ _testObject =
new SubTypeHierarchyViewer.SubTypeHierarchyContentProvider(
_lifeCycle);
_lifeCycle.doHierarchyRefresh(new IType[]{_T1_R1}, new NullProgressMonitor());
@@ -288,12 +288,12 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
ITypeHierarchy hierarchy = _lifeCycle.getHierarchy();
assertNotNull(hierarchy);
}
-
+
public void testGetParent()
{
Object actual;
Map<IType, IType> parents = getParentMap();
-
+
for (int idx = 0; idx < _allTypesInProject.length; idx++)
{
IType cur = _allTypesInProject[idx];
@@ -317,25 +317,25 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
parents.put(_T7_R2, _T5_R2);
parents.put(_T7_R3, _T5_R3);
parents.put(_T8_R2, _T2_R2);
-
+
parents.put(_T2_R2, _T2_R1); // since T1$R2 is outside the cone of T1$R1 we see T2$R2 below its explicit super
return parents;
}
-
+
public void testRecursiveGetChildren_T1R1()
{
TreeNode actualRoot;
TreeNode expectedRoot;
-
+
//pretty ugly, maybe replace this with an automatic hierarchy creation
- //that generates the hierarchy according to some String or with the help
+ //that generates the hierarchy according to some String or with the help
//of an array of types that denotes a path :-I
expectedRoot = new TreeNode(_T1_R1);
-
+
expectedRoot.setChildrenByElements(new Object[] {_T2_R1});
-
+
expectedRoot.getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T2_R2, _T3_R1, _T5_R1, _T6_R1}); // T4$R2 is not a direct child of T2$R1
-
+
expectedRoot.getChildNode(_T2_R1).getChildNode(_T2_R2).setChildrenByElements(new Object[] {_T3_R2, _T4_R2, _T5_R2, _T8_R2}); // include T8$R2: indirect via phantom and tsub
expectedRoot.getChildNode(_T2_R1).getChildNode(_T3_R1).setChildrenByElements(new Object[] {_T3_R2});
expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T5_R3}); // don't include T7$R3: indirect via phantom and extends
@@ -344,26 +344,26 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
expectedRoot.getChildNode(_T2_R1).getChildNode(_T2_R2).getChildNode(_T5_R2).setChildrenByElements(new Object[] {_T7_R2});
expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).setChildrenByElements(new Object[] {_T7_R3, _T5_R2});
expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).getChildNode(_T7_R3).setChildrenByElements(new Object[] {_T7_R2});
-
-// already rooted under T5$R2
+
+// already rooted under T5$R2
// expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).getChildNode(_T7_R3).setChildrenByElements(new Object[] {_T7_R2});
expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).getChildNode(_T5_R2).setChildrenByElements(new Object[] {_T7_R2});
// T2$R2 is not a sub of T6$R1!
// expectedRoot.getChildNode(_T2_R1).getChildNode(_T6_R1).getChildNode(_T2_R2).setChildrenByElements(new Object[] {_T3_R2, _T5_R2, _T4_R2, _T8_R2});
// expectedRoot.getChildNode(_T2_R1).getChildNode(_T6_R1).getChildNode(_T2_R2).getChildNode(_T5_R2).setChildrenByElements(new Object[]{_T7_R2});
-
+
actualRoot = fillTree(_testObject, new TreeNode(_T1_R1));
-
+
assertTrue("Hierarchy trees don't match", expectedRoot.equalsAsserted(actualRoot, new ITypeComparator(), 0));
}
-
+
// this test indirectly asserts symmetry between getChildren() and getParent()
public void testRecursiveGetChildren_againstParentMap_T1R1()
{
TreeNode actualRoot;
TreeNode expectedRoot;
-
+
expectedRoot = new TreeNode(_T1_R1);
Map<IType, IType> parentMap = getParentMap();
@@ -388,15 +388,15 @@ public class OTSubHierarchyContentProviderTests extends FileBasedUITest
expectedRoot.findNode(_T3_R1).addChild(expectedRoot.findNode(_T3_R2)); // already reachable via T2$R2
actualRoot = fillTree(_testObject, new TreeNode(_T1_R1));
-
+
assertTrue("Hierarchy trees don't match", expectedRoot.equalsAsserted(actualRoot, new ITypeComparator(), 0));
}
-
+
private TreeNode fillTree(ITreeContentProvider contentProvider, TreeNode curNode)
{
Object[] children = contentProvider.getChildren(curNode.getElement());
TreeNode[] treeChildren = curNode.setChildrenByElements(children);
-
+
for (int idx = 0; idx < treeChildren.length; idx++)
{
fillTree(contentProvider, treeChildren[idx]);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java
index 0bda3d5bf..74c11e707 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.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
@@ -40,15 +40,15 @@ import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
public class SuperHierarchyContentProviderTests extends FileBasedUITest
{
private static final String FAKED_PLUGIN_ID = "org.eclipse.objectteams.otdt.tests";
-
+
private static final String PROJECT_DIR = "Hierarchy";
private static final String SRC_FOLDER = "src";
-
+
private SuperTypeHierarchyViewer.SuperTypeHierarchyContentProvider _testObject;
//call doHierarchyRefresh(IJavaElement element, null) on _lifeCycle
//to create a hierarchy on element.
private TypeHierarchyLifeCycle _lifeCycle;
-
+
private IType _objectType;
private IType _T1;
@@ -59,32 +59,32 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
private IType _T6;
private IType _T7;
private IType _T8;
-
+
private IType _T1_R1;
private IType _T1_R2;
-
+
private IType _T2_R1;
private IType _T2_R2;
-
+
private IType _T3_R1;
private IType _T3_R2;
-
+
private IType _T4_R2;
-
+
private IType _T5_R1;
private IType _T5_R2;
private IType _T5_R3;
-
+
private IType _T6_R1;
-
+
private IType _T7_R2;
private IType _T7_R3;
-
+
private IType _T8_R2;
-
+
private IType[] _allTypesInProject;
-
+
public SuperHierarchyContentProviderTests(String name)
{
super(name);
@@ -92,11 +92,11 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
protected String getPluginID()
{
- //overwrites the ID because tests are using the
+ //overwrites the ID because tests are using the
//workspace of org.eclipse.objectteams.otdt.tests
return FAKED_PLUGIN_ID;
}
-
+
public static Test suite()
{
if (true)
@@ -107,175 +107,175 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir(PROJECT_DIR);
-
+
super.setUpSuite();
-
-
+
+
String pkg = "test001";
- _T1 =
+ _T1 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1");
-
- _T2 =
+
+ _T2 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2");
- _T3 =
+ _T3 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3");
-
- _T4 =
+
+ _T4 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4");
- _T5 =
+ _T5 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5");
- _T6 =
+ _T6 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6");
-
- _T7 =
+
+ _T7 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7");
- _T8 =
+ _T8 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8");
- _objectType =
+ _objectType =
getType(getTestProjectDir(),
"rt.jar",
"java.lang",
"Object");
-
+
_T1_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1",
"R1").getCorrespondingJavaElement();
-
+
_T1_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1",
"R2").getCorrespondingJavaElement();
-
+
_T2_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2",
"R1").getCorrespondingJavaElement();
-
+
_T2_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2",
"R2").getCorrespondingJavaElement();
-
+
_T3_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R1").getCorrespondingJavaElement();
-
+
_T3_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R2").getCorrespondingJavaElement();
-
+
_T4_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4",
"R2").getCorrespondingJavaElement();
-
+
_T5_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R1").getCorrespondingJavaElement();
-
+
_T5_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R2").getCorrespondingJavaElement();
-
+
_T5_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R3").getCorrespondingJavaElement();
-
+
_T6_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6",
"R1").getCorrespondingJavaElement();
-
+
_T7_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R2").getCorrespondingJavaElement();
-
+
_T7_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R3").getCorrespondingJavaElement();
-
+
_T8_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8",
"R2").getCorrespondingJavaElement();
-
-
+
+
_allTypesInProject = new IType[]
{
_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
- _T1_R1, _T1_R2,
+ _T1_R1, _T1_R2,
_T2_R1, _T2_R2,
_T3_R1, _T3_R2,
_T4_R2,
@@ -285,7 +285,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
_T8_R2
};
_lifeCycle = new TypeHierarchyLifeCycle(true);
- _testObject =
+ _testObject =
new SuperTypeHierarchyViewer.SuperTypeHierarchyContentProvider(
_lifeCycle);
@@ -299,18 +299,18 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
fail("JavaModelException while refreshing hierarchy");
}
}
-
+
public void testHierarchyCreated()
{
ITypeHierarchy hierarchy = _lifeCycle.getHierarchy();
assertNotNull(hierarchy);
}
-
+
public void testGetParentAlwaysNull()
{
Object expected = null;
Object actual;
-
+
for (int idx = 0; idx < _allTypesInProject.length; idx++)
{
IType cur = _allTypesInProject[idx];
@@ -318,7 +318,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
assertEquals("Parent not null for " + cur.getElementName() + " ", expected, actual);
}
}
-
+
public void testGetChildren_T5R3()
{
IType[] expected = new IType[]{ _T5_R1 };
@@ -334,7 +334,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
_lifeCycle.doHierarchyRefresh(new IType[]{_T3_R2}, new NullProgressMonitor());
IType[] expected = new IType[]{ _T3_R1, _T2_R2 };
IType[] actual = castToIType(_testObject.getChildren(_T3_R2));
-
+
assertTrue("Wrong supertypes", compareTypes(expected, actual));
}
catch (JavaModelException exc)
@@ -353,7 +353,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
_lifeCycle.doHierarchyRefresh(new IType[]{_T1_R2}, new NullProgressMonitor());
IType[] expected = new IType[]{ _objectType };
IType[] actual = castToIType(_testObject.getChildren(_T1_R2));
-
+
assertTrue("Wrong supertypes", compareTypes(expected, actual));
}
catch (JavaModelException exc)
@@ -373,7 +373,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
_lifeCycle.doHierarchyRefresh(new IType[]{_T8_R2}, new NullProgressMonitor());
IType[] expected = new IType[]{ _T6_R1, _T2_R2 };
IType[] actual = castToIType(_testObject.getChildren(_T8_R2));
-
+
assertTrue("Wrong supertypes", compareTypes(expected, actual));
}
catch (JavaModelException exc)
@@ -385,7 +385,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
}
}
-
+
public void testRecursiveGetChildren_T7R3() throws JavaModelException
{
try
@@ -393,28 +393,28 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
_lifeCycle.doHierarchyRefresh(new IType[]{_T7_R3}, new NullProgressMonitor());
TreeNode actualRoot;
TreeNode expectedRoot;
-
+
//pretty ugly, maybe replace this with an automatic hierarchy creation
- //that generates the hierarchy according to some String or with the help
+ //that generates the hierarchy according to some String or with the help
//of an array of types that denotes a path :-I
expectedRoot = new TreeNode(_T7_R3);
-
+
expectedRoot.setChildrenByElements(new Object[] {_T5_R1, _T5_R3});
expectedRoot.getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T2_R1, _objectType});
expectedRoot.getChildNode(_T5_R3).setChildrenByElements(new Object[] {_T5_R1});
-
+
expectedRoot.getChildNode(_T5_R1).getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T1_R1, _objectType});
expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T2_R1, _objectType});
-
+
expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T1_R1, _objectType});
-
+
expectedRoot.getChildNode(_T5_R1).getChildNode(_T2_R1).getChildNode(_T1_R1).setChildrenByElements(new Object[] {_objectType});
-
+
expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).getChildNode(_T2_R1).getChildNode(_T1_R1).setChildrenByElements(new Object[] {_objectType});
-
-
+
+
actualRoot = fillTree(_testObject, new TreeNode(_T7_R3));
-
+
assertTrue("Hierarchy trees don't match", expectedRoot.equalsAsserted(actualRoot, new ITypeComparator(), 0));
}
catch (JavaModelException exc)
@@ -424,7 +424,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
} finally {
_lifeCycle.doHierarchyRefresh(new IType[]{_T5_R3}, new NullProgressMonitor());
}
-
+
}
// test looks quite incomplete!?
@@ -442,19 +442,19 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
//
// assertTrue("Wrong methods", false);
// }
-
+
private TreeNode fillTree(ITreeContentProvider contentProvider, TreeNode curNode)
{
Object[] children = contentProvider.getChildren(curNode.getElement());
TreeNode[] treeChildren = curNode.setChildrenByElements(children);
-
+
for (int idx = 0; idx < treeChildren.length; idx++)
{
fillTree(contentProvider, treeChildren[idx]);
}
return curNode;
}
-
+
private IType[] castToIType(Object[] types)
{
if(types == null)
@@ -462,7 +462,7 @@ public class SuperHierarchyContentProviderTests extends FileBasedUITest
return null;
}
IType[] result = new IType[types.length];
-
+
for (int idx = 0; idx < types.length; idx++)
{
result[idx] = (IType)types[idx];
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TraditionalHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TraditionalHierarchyContentProviderTests.java
index f9e64cf2a..fc84e9326 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TraditionalHierarchyContentProviderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TraditionalHierarchyContentProviderTests.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,15 +40,15 @@ import junit.framework.Test;
public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
{
private static final String FAKED_PLUGIN_ID = "org.eclipse.objectteams.otdt.tests";
-
+
private static final String PROJECT_DIR = "Hierarchy";
private static final String SRC_FOLDER = "src";
-
+
private TraditionalHierarchyContentProvider _testObject;
//call doHierarchyRefresh(IJavaElement element, null) on _lifeCycle
//to create a hierarchy on element.
private TypeHierarchyLifeCycle _lifeCycle;
-
+
private IType _objectType;
private IType _T1;
@@ -59,32 +59,32 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
private IType _T6;
private IType _T7;
private IType _T8;
-
+
private IType _T1_R1;
private IType _T1_R2;
-
+
private IType _T2_R1;
private IType _T2_R2;
-
+
private IType _T3_R1;
private IType _T3_R2;
-
+
private IType _T4_R2;
-
+
private IType _T5_R1;
private IType _T5_R2;
private IType _T5_R3;
-
+
private IType _T6_R1;
-
+
private IType _T7_R2;
private IType _T7_R3;
-
+
private IType _T8_R2;
-
+
private IType[] _allTypesInProject;
-
+
public TraditionalHierarchyContentProviderTests(String name)
{
super(name);
@@ -92,11 +92,11 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
protected String getPluginID()
{
- //overwrites the ID because tests are using the
+ //overwrites the ID because tests are using the
//workspace of org.eclipse.objectteams.otdt.tests
return FAKED_PLUGIN_ID;
}
-
+
public static Test suite()
{
if (true)
@@ -107,16 +107,16 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
.getName());
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir(PROJECT_DIR);
-
- super.setUpSuite();
-
+
+ super.setUpSuite();
+
initializeTypes();
_lifeCycle = new TypeHierarchyLifeCycle(true);
- _testObject =
+ _testObject =
new TraditionalHierarchyViewer.TraditionalHierarchyContentProvider(_lifeCycle);
}
@@ -124,165 +124,165 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
private void initializeTypes() throws JavaModelException {
String pkg = "test001";
- _T1 =
+ _T1 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1");
-
- _T2 =
+
+ _T2 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2");
- _T3 =
+ _T3 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3");
-
- _T4 =
+
+ _T4 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4");
- _T5 =
+ _T5 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5");
- _T6 =
+ _T6 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6");
-
- _T7 =
+
+ _T7 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7");
- _T8 =
+ _T8 =
getType(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8");
- _objectType =
+ _objectType =
getType(getTestProjectDir(),
"rt.jar",
"java.lang",
"Object");
-
+
_T1_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1",
"R1").getCorrespondingJavaElement();
-
+
_T1_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T1",
"R2").getCorrespondingJavaElement();
-
+
_T2_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2",
"R1").getCorrespondingJavaElement();
-
+
_T2_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T2",
"R2").getCorrespondingJavaElement();
-
+
_T3_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R1").getCorrespondingJavaElement();
-
+
_T3_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T3",
"R2").getCorrespondingJavaElement();
-
+
_T4_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T4",
"R2").getCorrespondingJavaElement();
-
+
_T5_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R1").getCorrespondingJavaElement();
-
+
_T5_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R2").getCorrespondingJavaElement();
-
+
_T5_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T5",
"R3").getCorrespondingJavaElement();
-
+
_T6_R1 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T6",
"R1").getCorrespondingJavaElement();
-
+
_T7_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R2").getCorrespondingJavaElement();
-
+
_T7_R3 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T7",
"R3").getCorrespondingJavaElement();
-
+
_T8_R2 = (IType)
getRole(getTestProjectDir(),
SRC_FOLDER,
pkg,
"T8",
"R2").getCorrespondingJavaElement();
-
-
+
+
_allTypesInProject = new IType[]
{
_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
- _T1_R1, _T1_R2,
+ _T1_R1, _T1_R2,
_T2_R1, _T2_R2,
_T3_R1, _T3_R2,
_T4_R2,
@@ -301,9 +301,9 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
{
exc.printStackTrace();
fail("JavaModelException while refreshing hierarchy");
- }
+ }
}
-
+
IType[] getParentChain_T5R2() {
return new IType[] { _T2_R2, _T1_R2, _T5_R3, _T5_R1, _T2_R1, _T1_R1, _objectType };
}
@@ -312,7 +312,7 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
{
IType current = _T5_R2;
setHierarchyFocus(current);
-
+
IType[] expected = getParentChain_T5R2();
int i=0;
while ((current = (IType) _testObject.getParent(current)) != null) {
@@ -327,8 +327,8 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
setHierarchyFocus(current);
_T2_R2 = _T1_R2 = _T5_R3 = _T5_R1 = _T2_R1 = _T1_R1 = _objectType = null;
System.gc();
- initializeTypes();
-
+ initializeTypes();
+
IType[] expected = getParentChain_T5R2();
int i=0;
while ((current = (IType) _testObject.getParent(current)) != null) {
@@ -339,7 +339,7 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
public void testPathToT5R2()
{
setHierarchyFocus(_T5_R2);
-
+
IType[] expected = getParentChain_T5R2();
for (int i=expected.length-1; i>0; i--) {
IType[] subs = castToIType(_testObject.getChildren(expected[i]));
@@ -349,8 +349,8 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
assertEquals("Unexpected child ("+i+"): "+actualType.getElementName(), expectedType, actualType);
}
}
-
-
+
+
private IType[] castToIType(Object[] types)
{
if(types == null)
@@ -358,7 +358,7 @@ public class TraditionalHierarchyContentProviderTests extends FileBasedUITest
return null;
}
IType[] result = new IType[types.length];
-
+
for (int idx = 0; idx < types.length; idx++)
{
result[idx] = (IType)types[idx];
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
index 1abb03ae4..015142225 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.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
@@ -32,9 +32,9 @@ import org.eclipse.objectteams.otdt.tests.FileBasedTest;
public class TreeNode
{
- private HashMap<Object, TreeNode> _children; //keys: elements, values: TreeNodes
+ private HashMap<Object, TreeNode> _children; //keys: elements, values: TreeNodes
private Object _element;
-
+
public TreeNode(Object element)
{
_element = element;
@@ -45,7 +45,7 @@ public class TreeNode
{
return _children.get(element);
}
-
+
public TreeNode[] setChildrenByElements(Object[] childrenElements)
{
if(childrenElements == null)
@@ -58,45 +58,45 @@ public class TreeNode
}
return getChildren();
}
-
+
public void addChildByElement(Object childElement) {
_children.put(childElement, new TreeNode(childElement));
}
-
+
public Object getElement()
{
return _element;
}
-
+
public TreeNode[] getChildren()
{
return _children.values().toArray(new TreeNode[_children.values().size()]);
}
-
+
public HashMap<Object, TreeNode> getChildrenMap()
{
return _children;
}
-
+
public Object[] getChildrenElements()
{
return _children.keySet().toArray();
}
-
+
public boolean equalsAsserted(TreeNode other, Comparator comp, int level)
{
if(!comp.same(_element, other.getElement()))
{
- FileBasedTest.assertTrue("This tree element " + _element
- + " is different from " + other.getElement()
+ FileBasedTest.assertTrue("This tree element " + _element
+ + " is different from " + other.getElement()
+ " at level: " + level, false);
return false;
}
-
+
HashMap<Object, TreeNode> othersChildren = other.getChildrenMap();
if(_children.size() != othersChildren.size())
{
- FileBasedTest.assertEquals("this: " + _element + ", other: " + other.getElement() + " at level: "
+ FileBasedTest.assertEquals("this: " + _element + ", other: " + other.getElement() + " at level: "
+ level, _children.size(), othersChildren.size());
return false;
}
@@ -142,7 +142,7 @@ public class TreeNode
public void addChild(TreeNode node) {
this._children.put(node.getElement(), node);
-
+
}
// facilitate debugging:
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java
index ea81546a2..4b9354414 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.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
@@ -37,7 +37,7 @@ import junit.framework.TestSuite;
*/
public class AllInternalRoleCreationTests extends TestCase
{
- public AllInternalRoleCreationTests(String name)
+ public AllInternalRoleCreationTests(String name)
{
super(name);
}
@@ -49,7 +49,7 @@ public class AllInternalRoleCreationTests extends TestCase
org.eclipse.objectteams.otdt.ui.tests.typecreator.RoleCreationTests.class
};
}
-
+
public static TestSetting getActualTestSetting()
{
return new TestSetting("CreationTestProject", "internaldefinedrole", "teampkg");
@@ -73,7 +73,7 @@ public class AllInternalRoleCreationTests extends TestCase
try
{
TestDataHandler.addTestSetting(testClass, getActualTestSetting());
-
+
Method suiteMethod = testClass.getDeclaredMethod(
"suite", new Class[0]); //$NON-NLS-1$
Test suite = (Test) suiteMethod.invoke(null, new Object[0]);
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java
index c016af76e..d4e6b3410 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.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
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java
index edccc34fb..608574839 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.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
@@ -34,7 +34,7 @@ import org.eclipse.objectteams.otdt.internal.ui.wizards.listeners.NewTeamWizardP
public class NewTeamWizardPageListenerTest extends TestCase
{
private NewTeamWizardPage _teamWizardPage;
-
+
protected void setUp() throws Exception
{
super.setUp();
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java
index 1e6dd2127..a692aafa4 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.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
@@ -52,10 +52,10 @@ public class RoleCreationTests extends FileBasedUITest
/*this test class contains tests for internal defined roles*/
private static boolean DOINLINE = true;
private static String SRC_FOLDER_NAME = "internaldefinedrole";
-
+
private RoleCreator _roleCreator;
-
+
public RoleCreationTests(String name)
{
super(name);
@@ -72,25 +72,25 @@ public class RoleCreationTests extends FileBasedUITest
Suite suite = new Suite(RoleCreationTests.class);
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir("CreationTestProject");
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
_roleCreator = new RoleCreator();
}
-
+
@Override
protected void tearDown() throws Exception {
ICompilationUnit[] primaryWCs = JavaModelManager.getJavaModelManager().getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, false);
try {
assertEquals("All working copies should be discarded", 0, primaryWCs == null ? 0 : primaryWCs.length);
- } finally {
+ } finally {
if (primaryWCs != null)
for (int i = 0; i < primaryWCs.length; i++)
primaryWCs[i].discardWorkingCopy();
@@ -105,8 +105,8 @@ public class RoleCreationTests extends FileBasedUITest
// public void tearDownSuite()
// {
// //don't call super method, so created directory will not be deleted
-// }
-
+// }
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
ICompilationUnit typeUnit = getCompilationUnit(
@@ -115,13 +115,13 @@ public class RoleCreationTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
+ }
/**
* This method tests the creation of a simple role class (no super role, no super interface, no base class)
@@ -136,29 +136,29 @@ public class RoleCreationTests extends FileBasedUITest
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole");
typeInfo.setInline(false);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg.TeamForSimpleRole", "SimpleRole");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
}
-
+
/**
* This method tests the creation of a simple role class (no super role, no super interface, no base class)
* initially the role's hosting team already contains one role class
@@ -172,29 +172,29 @@ public class RoleCreationTests extends FileBasedUITest
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole_PreviouslyWithOneRole");
typeInfo.setInline(DOINLINE);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole_PreviouslyWithOneRole");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("SimpleRole");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
}
-
+
/**
* This method tests the creation of a simple role class (no super role, no super interface, no base class)
* initially the role's hosting team already contains several role classes
@@ -208,29 +208,29 @@ public class RoleCreationTests extends FileBasedUITest
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole_PreviouslyWithTwoRoles");
typeInfo.setInline(DOINLINE);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole_PreviouslyWithTwoRoles");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("SimpleRole");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
- }
-
+ }
+
/**
* This method tests the creation of a role class that has one super interface
* initially the role's hosting team class is empty
@@ -239,47 +239,47 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
ArrayList<String> interfaceNameList = new ArrayList<String>();
- interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
-
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithOneSuperInterface", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOneSuperInterface");
typeInfo.setInline(DOINLINE);
typeInfo.setSuperInterfacesNames(interfaceNameList);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOneSuperInterface");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithOneSuperInterface");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
assertNotNull(interfaceNames);
assertTrue(interfaceNames.length == 1);
assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
-
+
String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
assertNotNull(interfacesSignatures);
assertTrue(interfacesSignatures.length == 1);
assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
- }
+ }
/**
* This method tests the creation of a role class that has several super interfaces
@@ -289,53 +289,53 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
ArrayList<String> interfaceNameList = new ArrayList<String>();
interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSeveralSuperInterfaces", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithSeveralSuperInterfaces");
typeInfo.setInline(DOINLINE);
typeInfo.setSuperInterfacesNames(interfaceNameList);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperInterfaces");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSeveralSuperInterfaces");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
assertNotNull(interfaceNames);
assertTrue(interfaceNames.length > 0);
assertTrue(interfaceNames.length == 2);
assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
-
+
String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
assertNotNull(interfacesSignatures);
assertTrue(interfacesSignatures.length > 0);
assertTrue(interfacesSignatures.length == 2);
assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
assertEquals("QInterfaceWithTwoMethods;", interfacesSignatures[1]);
- }
-
+ }
+
/**
* This method tests the creation of a role class that has one super interface
* the role class should contain the abstract method that it inherits from its super interface
@@ -345,129 +345,129 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
ArrayList<String> interfaceNameList = new ArrayList<String>();
interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSuperInterfaceAndInheritedMethod", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOneSuperInterfaceAndInheritedMethod");
typeInfo.setInline(DOINLINE);
typeInfo.setSuperInterfacesNames(interfaceNameList);
typeInfo.setCreateAbstractInheritedMethods(true);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOneSuperInterfaceAndInheritedMethod");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSuperInterfaceAndInheritedMethod");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
assertNotNull(interfaceNames);
assertTrue(interfaceNames.length == 1);
assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
-
+
String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
assertNotNull(interfacesSignatures);
assertTrue(interfacesSignatures.length == 1);
assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 1);
assertEquals("methodToImplement", methods[0].getElementName());
}
-
+
/**
* This method tests the creation of a role class that has several super interfaces
* the role class should contain all abstract methods that it inherits from its several super interfaces
* initially the role's hosting team class is empty
- */
+ */
public void testRoleCreation_WithSeveralSuperInterfacesAndInheritedMethods() throws InterruptedException,
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
ArrayList<String> interfaceNameList = new ArrayList<String>();
interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSeveralSuperInterfacesAndInheritedMethods", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods");
typeInfo.setInline(DOINLINE);
typeInfo.setSuperInterfacesNames(interfaceNameList);
typeInfo.setCreateAbstractInheritedMethods(true);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSeveralSuperInterfacesAndInheritedMethods");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
assertNotNull(interfaceNames);
assertTrue(interfaceNames.length > 0);
assertTrue(interfaceNames.length == 2);
assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
-
+
String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
assertNotNull(interfacesSignatures);
assertTrue(interfacesSignatures.length > 0);
assertTrue(interfacesSignatures.length == 2);
assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
assertEquals("QInterfaceWithTwoMethods;", interfacesSignatures[1]);
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 3);
-
+
IMethod method = roleJavaElem.getMethod("methodToImplement", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
-
+
method = roleJavaElem.getMethod("methodToImplementA", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
-
+
method = roleJavaElem.getMethod("methodToImplementB", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
- }
-
+ }
+
/**
* This method tests the creation of a role class that is bound to a base class
* the base class is an ordinary class
@@ -477,92 +477,92 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithOrdinaryBase", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOrdinaryBase");
typeInfo.setInline(DOINLINE);
typeInfo.setBaseTypeName("ordinarypkg.EmptyClass");
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOrdinaryBase");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithOrdinaryBase");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertTrue(roleOTElem instanceof IRoleType);
IRoleType roleOTRoleElem = (IRoleType) roleOTElem;
IType baseJavaElem = roleOTRoleElem.getBaseClass();
-
+
assertNotNull(baseJavaElem);
assertEquals("ordinarypkg.EmptyClass", baseJavaElem.getFullyQualifiedName());
}
-
+
/**
* This method tests the creation of a role class that is bound to a base class
* the base class is a team class
* initially the role's hosting team class is empty
- */
+ */
public void testRoleCreation_WithTeamBase() throws InterruptedException,
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithTeamBase", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithTeamBase");
typeInfo.setInline(DOINLINE);
typeInfo.setBaseTypeName("teampkg.EmptyBaseTeam");
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithTeamBase");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithTeamBase");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertTrue(roleOTElem instanceof IRoleType);
IRoleType roleOTRoleElem = (IRoleType) roleOTElem;
IType baseJavaElem = roleOTRoleElem.getBaseClass();
-
+
assertNotNull(baseJavaElem);
assertEquals("teampkg.EmptyBaseTeam", baseJavaElem.getFullyQualifiedName());
-
+
IOTType baseOTElem = OTModelManager.getOTElement(baseJavaElem);
assertNotNull(baseOTElem);
assertTrue(baseOTElem.isTeam());
- }
-
-
+ }
+
+
/**
* This method tests the creation of a role class that has an explicit superclass.
* The explicit superclass resides in the same team class as the newly created role class.
@@ -571,12 +571,12 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole";
final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClass";
@@ -585,16 +585,16 @@ public class RoleCreationTests extends FileBasedUITest
typeInfo.setInline(DOINLINE);
typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.SuperRole");
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
@@ -602,59 +602,59 @@ public class RoleCreationTests extends FileBasedUITest
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertEquals("SuperRole", roleJavaElem.getSuperclassName());
assertEquals("QSuperRole;", roleJavaElem.getSuperclassTypeSignature());
}
-
-
+
+
/**
* This method tests the creation of a role class that has an explicit superclass.
* The explicit superclass does not reside in the same team class as the newly created role class,
- * but in a super team of that team.
+ * but in a super team of that team.
*/
public void testRoleCreation_WithExplicitSuperClass_FromSuperTeam() throws InterruptedException,
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclass_PreviouslyEmpty";
final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClass";
RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
typeInfo.setInline(DOINLINE);
-//TODO (kaschja) ??? must "teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod" be set as super role class ??? (because it is the team class where the super role comes from)
+//TODO (kaschja) ??? must "teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod" be set as super role class ??? (because it is the team class where the super role comes from)
typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.RoleWithAbstractMethod");
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
}
-
-
+
+
/**
* This method tests the creation of a role class that has an explicit superclass.
* the role class should contain the abstract method that it inherits from its superclass
@@ -664,12 +664,12 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole";
final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClassAndInheritedMethod";
@@ -679,35 +679,35 @@ public class RoleCreationTests extends FileBasedUITest
typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.RoleWithAbstractMethod");
typeInfo.setCreateAbstractInheritedMethods(true);
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 1);
assertEquals("methodToImplement1", methods[0].getElementName());
}
-
-
+
+
/**
* This method tests the creation of a role class that has an explicit superclass.
* The role class should contain the abstract method that it inherits from its superclass.
@@ -718,54 +718,54 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty";
final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClassAndInheritedMethod";
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
typeInfo.setInline(DOINLINE);
//TODO (kaschja) ??? must "teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod" be set as super role class ??? (because it is the team class where the super role comes from)
// typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.RoleWithAbstractMethod");
- typeInfo.setSuperClassName("teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod");
+ typeInfo.setSuperClassName("teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod");
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
-
+
+
typeInfo.setCreateAbstractInheritedMethods(true);
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithExplicitSuperClassAndInheritedMethod");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 1);
assertEquals("methodToImplement1", methods[0].getElementName());
}
-
-
+
+
/**
* This method tests the creation of a role class that has an implicit superclass.
* The role class should contain the abstract method that it inherits from its superclass.
@@ -774,71 +774,71 @@ public class RoleCreationTests extends FileBasedUITest
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
final String TEAM_CLASS_NAME = "TeamForRoleWithImplicitSuperClassAndInheritedMethod";
final String ROLE_CLASS_NAME = "RoleWithAbstractMethod";
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
typeInfo.setInline(DOINLINE);
typeInfo.setCreateAbstractInheritedMethods(true);
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithImplicitSuperClassAndInheritedMethod");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithAbstractMethod");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 1);
- assertEquals("methodToImplement1", methods[0].getElementName());
+ assertEquals("methodToImplement1", methods[0].getElementName());
}
-
-
+
+
/**
* This method tests the creation of a role class that has
* an implicit superclass and an explicit superclass and several super interfaces.
- * The role class should contain all abstract methods that it inherits from
+ * The role class should contain all abstract methods that it inherits from
* its several super classes and interfaces
*/
public void testRoleCreation_WithSeveralSuperTypesAndInheritedMethods() throws InterruptedException,
CoreException
{
/*creation of role*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
ArrayList<String> interfaceNameList = new ArrayList<String>();
interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
-
+
//the role to be created should be named "RoleWithAbstractMethod" although it contains several abstract methods
//in order to establish the implicit inheritence relationship with TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod
- final String ROLE_CLASS_NAME = "RoleWithAbstractMethod";
+ final String ROLE_CLASS_NAME = "RoleWithAbstractMethod";
final String TEAM_CLASS_NAME = "TeamForRoleWithSeveralSuperTypesAndInheritedMethods";
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
typeInfo.setInline(DOINLINE);
@@ -846,51 +846,51 @@ public class RoleCreationTests extends FileBasedUITest
typeInfo.setSuperInterfacesNames(interfaceNameList);
typeInfo.setCreateAbstractInheritedMethods(true);
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
-
+
/*test of role existence and properties*/
-
+
IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperTypesAndInheritedMethods");
assertNotNull(enclosingTeamJavaElem);
-
+
IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithAbstractMethod");
assertNotNull(roleJavaElem);
assertTrue(roleJavaElem.exists());
-
+
IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
assertNotNull(roleOTElem);
assertTrue(roleOTElem.isRole());
-
+
assertEquals("AbstractSuperRole", roleJavaElem.getSuperclassName());
assertEquals("QAbstractSuperRole;", roleJavaElem.getSuperclassTypeSignature());
-
+
String[] interfaceNames = roleJavaElem.getSuperInterfaceNames();
assertNotNull(interfaceNames);
assertTrue(interfaceNames.length > 0);
assertTrue(interfaceNames.length == 2);
assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
-
+
String[] interfaceSignatures = roleJavaElem.getSuperInterfaceTypeSignatures();
assertNotNull(interfaceSignatures);
assertTrue(interfaceSignatures.length > 0);
assertTrue(interfaceSignatures.length == 2);
assertEquals("QInterfaceWithOneMethod;", interfaceSignatures[0]);
assertEquals("QInterfaceWithTwoMethods;", interfaceSignatures[1]);
-
+
IMethod[] methods = roleJavaElem.getMethods();
assertNotNull(methods);
assertTrue(methods.length > 0);
assertTrue(methods.length == 5);
-
+
//method inherited from "InterfaceWithOneMethod"
IMethod method = roleJavaElem.getMethod("methodToImplement", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
-
+
//methods inherited from "InterfaceWithTwoMethods"
method = roleJavaElem.getMethod("methodToImplementA", new String[0]);
assertNotNull(method);
@@ -898,13 +898,13 @@ public class RoleCreationTests extends FileBasedUITest
method = roleJavaElem.getMethod("methodToImplementB", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
-
+
//method inherited from explicit superclass "AbstractSuperRole"
method = roleJavaElem.getMethod("methodToImplementX", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
-
- //method inherited from implicit superclass "TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod"
+
+ //method inherited from implicit superclass "TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod"
method = roleJavaElem.getMethod("methodToImplement1", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
@@ -924,14 +924,14 @@ public class RoleCreationTests extends FileBasedUITest
" }\n" +
" }\n" +
"}", false, new NullProgressMonitor());
-
+
RoleTypeInfo typeInfo = new RoleTypeInfo("XInner", pkgFragRoot, pkgFrag);
typeInfo.setEnclosingTypeName("teampkg.Outer.Mid.Inner");
typeInfo.setInline(true);
typeInfo.setCreateAbstractInheritedMethods(false);
typeInfo.setCurrentType(pkgFrag.getCompilationUnit("Outer.java")
.getType("Mid").getType("Inner").getType("XInner"));
-
+
assertNotNull(_roleCreator);
_roleCreator.setTypeInfo(typeInfo);
_roleCreator.createType(new NullProgressMonitor());
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java
index c3a8f87a6..5550f55c0 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.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
@@ -48,12 +48,12 @@ import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
*/
public class TeamCreationTests extends FileBasedUITest
{
-
+
private static final String SRC_FOLDER_NAME = "teams";
-
+
private TeamCreator _teamCreator;
-
-
+
+
public TeamCreationTests(String name)
{
super(name);
@@ -70,26 +70,26 @@ public class TeamCreationTests extends FileBasedUITest
junit.framework.TestSuite suite = new Suite(TeamCreationTests.class);
return suite;
}
-
+
public void setUpSuite() throws Exception
{
setTestProjectDir("CreationTestProject");
-
+
super.setUpSuite();
}
-
+
protected void setUp() throws Exception
{
super.setUp();
_teamCreator = new TeamCreator();
}
-
+
@Override
protected void tearDown() throws Exception {
ICompilationUnit[] primaryWCs = JavaModelManager.getJavaModelManager().getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, false);
try {
assertEquals("All working copies should be discarded", 0, primaryWCs == null ? 0 : primaryWCs.length);
- } finally {
+ } finally {
if (primaryWCs != null)
for (int i = 0; i < primaryWCs.length; i++)
primaryWCs[i].discardWorkingCopy();
@@ -105,8 +105,8 @@ public class TeamCreationTests extends FileBasedUITest
// {
// //don't call super method, so created directory will not be deleted
// }
-
-
+
+
private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
{
ICompilationUnit typeUnit = getCompilationUnit(
@@ -115,14 +115,14 @@ public class TeamCreationTests extends FileBasedUITest
pkgName,
typeName +".java");
IType typeJavaElem = typeUnit.getType(typeName);
-
+
if ((typeJavaElem != null) && (typeJavaElem.exists()))
{
return typeJavaElem;
}
return null;
- }
-
+ }
+
public void testCreation_EmptyTeam() throws JavaModelException,
InterruptedException,
@@ -132,24 +132,24 @@ public class TeamCreationTests extends FileBasedUITest
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
TypeInfo typeInfo = new TypeInfo("EmptyTeam", pkgFragRoot, pkgFrag);
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setSuperClassName("org.objectteams.Team");
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeam");
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
}
-
+
public void testCreation_NestedTeam() throws JavaModelException,
InterruptedException,
CoreException
@@ -158,31 +158,31 @@ public class TeamCreationTests extends FileBasedUITest
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
TypeInfo typeInfo = new TypeInfo("NestedTeam", pkgFragRoot, pkgFrag);
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setEnclosingTypeName("teampkg.TeamForNestedTeam");
typeInfo.setInline(true);
typeInfo.setCreateAbstractInheritedMethods(true);
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType enclosingJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForNestedTeam");
IType createdJavaType = enclosingJavaType.getType("NestedTeam");
assertNotNull(createdJavaType);
assertTrue("created type should exist", createdJavaType.exists());
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
IMethod[] methods = createdJavaType.getMethods();
assertEquals("Should not have created methods", 0, methods.length);
}
-
+
public void testCreation_TeamWithConstructor() throws JavaModelException,
InterruptedException,
CoreException
@@ -202,20 +202,20 @@ public class TeamCreationTests extends FileBasedUITest
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
// constructor is a method by the name of the enclosing class:
IMethod constructor = createdJavaType.getMethod(TEAM_CLASS_NAME, new String[0]);
assertNotNull(constructor);
assertTrue(constructor.exists());
- }
-
+ }
+
public void testCreation_TeamWithMainMethod() throws JavaModelException,
InterruptedException,
CoreException
@@ -229,24 +229,24 @@ public class TeamCreationTests extends FileBasedUITest
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setSuperClassName("org.objectteams.Team");
typeInfo.setCreateMainMethod(true);
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithMainMethod");
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
String[] paraTypes = {"[QString;"};
IMethod method = createdJavaType.getMethod("main", paraTypes);
assertNotNull(method);
assertTrue(method.exists());
-}
-
+}
+
public void testCreation_EmptyTeamWithEmptySuperTeam() throws JavaModelException,
InterruptedException,
CoreException
@@ -261,23 +261,23 @@ public class TeamCreationTests extends FileBasedUITest
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setSuperClassName("teampkg.EmptyTeam");
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType subTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeamWithEmptySuperTeam");
assertNotNull(subTeamJavaElem);
-
+
IOTType subTeamOTElem = OTModelManager.getOTElement(subTeamJavaElem);
assertNotNull(subTeamOTElem);
- assertTrue(subTeamOTElem.isTeam());
-
+ assertTrue(subTeamOTElem.isTeam());
+
assertEquals(subTeamOTElem.getSuperclassName(), "EmptyTeam");
assertEquals(subTeamOTElem.getSuperclassTypeSignature(), "QEmptyTeam;");
}
-
-
+
+
public void testCreation_EmptyTeamWithSuperInterface() throws JavaModelException,
InterruptedException,
CoreException
@@ -285,7 +285,7 @@ public class TeamCreationTests extends FileBasedUITest
IType interfaceJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "ordinarypkg", "InterfaceWithOneMethod");
assertNotNull(interfaceJavaElem);
assertTrue(interfaceJavaElem.exists());
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
@@ -293,34 +293,34 @@ public class TeamCreationTests extends FileBasedUITest
ArrayList<String> interfaceNames = new ArrayList<String>();
interfaceNames.add("ordinary.InterfaceWithOneMethod");
-
+
TypeInfo typeInfo = new TypeInfo("EmptyTeamWithSuperInterface", pkgFragRoot, pkgFrag);
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setSuperInterfacesNames(interfaceNames);
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeamWithSuperInterface");
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
String[] interfaces = createdOTType.getSuperInterfaceNames();
assertNotNull(interfaces);
assertTrue(interfaces.length == 1);
assertEquals(interfaces[0], "InterfaceWithOneMethod");
-
+
String[] interfaceSignatures = createdOTType.getSuperInterfaceTypeSignatures();
assertNotNull(interfaceSignatures);
assertTrue(interfaceSignatures.length == 1);
assertEquals(interfaceSignatures[0], "QInterfaceWithOneMethod;");
}
-
-
+
+
public void testCreation_TeamWithSuperInterfaceAndInheritedMethod() throws JavaModelException,
InterruptedException,
CoreException
@@ -328,9 +328,9 @@ public class TeamCreationTests extends FileBasedUITest
IType interfaceJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "ordinarypkg", "InterfaceWithOneMethod");
assertNotNull(interfaceJavaElem);
assertTrue(interfaceJavaElem.exists());
-
+
/*creation of team*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
@@ -338,41 +338,41 @@ public class TeamCreationTests extends FileBasedUITest
ArrayList<String> interfaceNames = new ArrayList<String>();
interfaceNames.add("ordinarypkg.InterfaceWithOneMethod");
-
+
String TEAM_CLASS_NAME = "TeamWithSuperInterfaceAndInheritedMethod";
TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
typeInfo.setSuperInterfacesNames(interfaceNames);
typeInfo.setCreateAbstractInheritedMethods(true);
typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
-
+
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithSuperInterfaceAndInheritedMethod");
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
String[] interfaces = createdOTType.getSuperInterfaceNames();
assertNotNull(interfaces);
assertTrue(interfaces.length == 1);
assertEquals(interfaces[0], "InterfaceWithOneMethod");
-
+
String[] interfaceSignatures = createdOTType.getSuperInterfaceTypeSignatures();
assertNotNull(interfaceSignatures);
assertTrue(interfaceSignatures.length == 1);
assertEquals(interfaceSignatures[0], "QInterfaceWithOneMethod;");
-
+
IMethod method = createdJavaType.getMethod("methodToImplement", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
}
-
-
+
+
public void testCreation_TeamWithSuperTeamAndInheritedMethod() throws JavaModelException,
InterruptedException,
CoreException
@@ -380,14 +380,14 @@ public class TeamCreationTests extends FileBasedUITest
IType superTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "AbstractTeamWithAbstractMethod");
assertNotNull(superTeamJavaElem);
assertTrue(superTeamJavaElem.exists());
-
+
/*creation of team*/
-
+
IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
assertNotNull(pkgFragRoot);
assertNotNull(pkgFrag);
-
+
String TEAM_CLASS_NAME = "TeamWithSuperTeamAndInheritedMethod";
TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
@@ -398,19 +398,19 @@ public class TeamCreationTests extends FileBasedUITest
assertNotNull(_teamCreator);
_teamCreator.setTypeInfo(typeInfo);
_teamCreator.createType(new NullProgressMonitor());
-
+
IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithSuperTeamAndInheritedMethod");
assertNotNull(createdJavaType);
-
+
IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
assertNotNull(createdOTType);
assertTrue(createdOTType.isTeam());
-
+
assertEquals(createdJavaType.getSuperclassName(), "AbstractTeamWithAbstractMethod");
assertEquals(createdJavaType.getSuperclassTypeSignature(), "QAbstractTeamWithAbstractMethod;");
-
+
IMethod method = createdJavaType.getMethod("methodToImplement", new String[0]);
assertNotNull(method);
assertTrue(method.exists());
- }
+ }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java
index bc159f37e..b0803993c 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.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
@@ -102,10 +102,10 @@ public class JavaProjectHelper extends org.eclipse.jdt.testplugin.JavaProjectHel
project.setDescription(description, null);
IJavaProject jproject = JavaCore.create(project);
-
+
jproject.setOutputLocation(outputLocation, null);
jproject.setRawClasspath(new IClasspathEntry[0], null);
-
+
OTREContainer.initializeOTJProject(project);
return jproject;
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java
index ab9e1dc6b..94c57b600 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.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
@@ -30,14 +30,14 @@ import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jface.preference.IPreferenceStore;
public class TestOptions {
-
+
public static Hashtable<String,String> getFormatterOptions()
{
Hashtable<String, String> result= JavaCore.getDefaultOptions();
result.putAll(TestFormatterOptions.getSettings());
return result;
}
-
+
public static void initializeCodeGenerationOptions()
{
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
@@ -59,7 +59,7 @@ class TestFormatterOptions
options.setDefaultSettings();
return options.getMap();
}
-
+
public int alignment_for_arguments_in_allocation_expression;
public int alignment_for_arguments_in_explicit_constructor_call;
public int alignment_for_arguments_in_method_invocation;
@@ -76,9 +76,9 @@ class TestFormatterOptions
public int alignment_for_superinterfaces_in_type_declaration;
public int alignment_for_throws_clause_in_constructor_declaration;
public int alignment_for_throws_clause_in_method_declaration;
-
+
public boolean align_type_members_on_columns;
-
+
public String brace_position_for_anonymous_type_declaration;
public String brace_position_for_array_initializer;
public String brace_position_for_block;
@@ -87,10 +87,10 @@ class TestFormatterOptions
public String brace_position_for_method_declaration;
public String brace_position_for_type_declaration;
public String brace_position_for_switch;
-
+
public int continuation_indentation;
public int continuation_indentation_for_array_initializer;
-
+
public int blank_lines_after_imports;
public int blank_lines_after_package;
public int blank_lines_before_field;
@@ -102,14 +102,14 @@ class TestFormatterOptions
public int blank_lines_before_package;
public int blank_lines_between_type_declarations;
public int blank_lines_at_beginning_of_method_body;
-
+
public boolean indent_statements_compare_to_block;
public boolean indent_statements_compare_to_body;
public boolean indent_body_declarations_compare_to_type_header;
public boolean indent_breaks_compare_to_cases;
public boolean indent_switchstatements_compare_to_cases;
public boolean indent_switchstatements_compare_to_switch;
-
+
public boolean insert_new_line_after_opening_brace_in_array_initializer;
public boolean insert_new_line_before_catch_in_try_statement;
public boolean insert_new_line_before_closing_brace_in_array_initializer;
@@ -241,7 +241,7 @@ class TestFormatterOptions
public int initial_indentation_level;
public String line_separator;
-
+
private TestFormatterOptions()
{
// cannot be instantiated

Back to the top