Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-06-12 13:50:17 +0000
committercletavernie2012-06-12 13:50:17 +0000
commitee2f2dab212d978e0089e77ae7e87c0bb1a4a4d4 (patch)
tree0873d3c5f1c3d55be3e0277624444bf261ab4262 /tests/junit/plugins
parentaf05ace5c7166b28f60dfa1ecb4447e94a6a4c0d (diff)
downloadorg.eclipse.papyrus-ee2f2dab212d978e0089e77ae7e87c0bb1a4a4d4.tar.gz
org.eclipse.papyrus-ee2f2dab212d978e0089e77ae7e87c0bb1a4a4d4.tar.xz
org.eclipse.papyrus-ee2f2dab212d978e0089e77ae7e87c0bb1a4a4d4.zip
370819: [Global] A Flexible Drag & Drop framework
https://bugs.eclipse.org/bugs/show_bug.cgi?id=370819 Update the tests
Diffstat (limited to 'tests/junit/plugins')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java
index 0d2aacb38d6..07b49e3559f 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.dnd.tests/src/org/eclipse/papyrus/uml/diagram/dnd/tests/tests/InstanceSpecificationTest.java
@@ -51,8 +51,9 @@ import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Property;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -64,16 +65,16 @@ import org.junit.Test;
*/
public class InstanceSpecificationTest {
- private Diagram diagram;
+ private static Diagram diagram;
- private PapyrusMultiDiagramEditor papyrusEditor;
+ private static PapyrusMultiDiagramEditor papyrusEditor;
- private final Set<IFile> model = new HashSet<IFile>();
+ private static final Set<IFile> model = new HashSet<IFile>();
- private DropStrategy strategy;
+ private static DropStrategy strategy;
- @Before
- public void init() {
+ @BeforeClass
+ public static void init() {
String projectName = "dnd.test";
String modelName = "drop"; //drop.di, drop.notation, drop.uml
@@ -84,11 +85,16 @@ public class InstanceSpecificationTest {
Assert.fail("Cannot load the test model");
}
- DropStrategyManager.instance.restoreDefaults();
strategy = DropStrategyManager.instance.findStrategy(org.eclipse.papyrus.uml.diagram.dnd.Activator.PLUGIN_ID + ".instanceSpecification");
}
- protected void initModel(String sourcePath, String projectName, String modelName) throws CoreException, IOException {
+ @Before
+ public void initDefaults() {
+ //Restore the default DND preferences before each test
+ DropStrategyManager.instance.restoreDefaults();
+ }
+
+ protected static void initModel(String sourcePath, String projectName, String modelName) throws CoreException, IOException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject(projectName);
@@ -115,15 +121,15 @@ public class InstanceSpecificationTest {
Assert.assertTrue("Cannot load the test diagram", diagram != null);
}
- protected void copyToWorkspace(URL sourceURL, IFile targetFile) throws CoreException, IOException {
+ protected static void copyToWorkspace(URL sourceURL, IFile targetFile) throws CoreException, IOException {
InputStream sourceStream = sourceURL.openStream();
targetFile.create(sourceStream, true, new NullProgressMonitor());
model.add(targetFile);
sourceStream.close();
}
- @After
- public void dispose() {
+ @AfterClass
+ public static void dispose() {
papyrusEditor.getSite().getPage().closeEditor(papyrusEditor, false);
for(IFile modelFile : model) {
try {

Back to the top