Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-14 05:34:05 -0400
committerCamille Letavernier2014-03-14 05:34:05 -0400
commitc918e450bb6cd14cf2104d13033571f9d5d46537 (patch)
tree181fa8aba77d2333b98a39abfd225df07e18e549 /tests/junit
parente6d3972b4a2cac593dadf021ee00d60dc9e1e699 (diff)
downloadorg.eclipse.papyrus-c918e450bb6cd14cf2104d13033571f9d5d46537.tar.gz
org.eclipse.papyrus-c918e450bb6cd14cf2104d13033571f9d5d46537.tar.xz
org.eclipse.papyrus-c918e450bb6cd14cf2104d13033571f9d5d46537.zip
430023: [Papyrus Tests] Papyrus shall propose different levels of
testing, to allow test-driven development https://bugs.eclipse.org/bugs/show_bug.cgi?id=430023 - Second implementation, based on Annotations and MethodRule. The annotated tests are currently green instead of being Ignored
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java25
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java10
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF4
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java42
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationConfig.java141
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationRule.java43
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/InvalidTest.java38
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/NotImplemented.java39
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/TestCategory.java53
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java10
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractPapyrusTest.java27
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java10
12 files changed, 369 insertions, 73 deletions
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
index 8d90eb5853f..55d0b76c88a 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
@@ -22,21 +22,21 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.junit.utils.TestMode;
+import org.eclipse.papyrus.junit.utils.classification.NotImplemented;
+import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
import org.eclipse.pde.internal.core.feature.Feature;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Test;
import org.osgi.framework.Bundle;
/**
* suppress restriction for org.eclipse.pde.internal.core.feature.Feature;
- *
+ *
* @author VL222926
*
*/
@SuppressWarnings("restriction")
-public class BundlesTests {
+public class BundlesTests extends AbstractPapyrusTest {
// Transform the version number to the regex format
// Adds .* (Valid version numbers are e.g. 0.10.1.qualifier)
@@ -113,20 +113,18 @@ public class BundlesTests {
/**
* Tests that we don't use import package
*/
+ @NotImplemented("Usage of importPackage is discouraged")
@Test
public void importPackage() {
- Assume.assumeTrue("Usage of importPackage is discouraged", TestMode.isStrict()); //$NON-NLS-1$
-
testManifestProperty(BundleTestsUtils.BUNDLE_IMPORT_PACKAGE, "", true, false); //$NON-NLS-1$
}
/**
* This test verify that we doesn't re-export dependencies
*/
+ @NotImplemented("Usage of reexported dependencies is discouraged")
@Test
public void reexportDependencies() {
- Assume.assumeTrue("Usage of reexported dependencies is discouraged", TestMode.isStrict());
-
StringBuffer message = new StringBuffer();
int nb = 0;
for(final Bundle current : BundleTestsUtils.getPapyrusBundles()) {
@@ -163,7 +161,7 @@ public class BundlesTests {
/**
* Tests if a the value of a property in the Manifest is correct
- *
+ *
* @param property
* the property to test
* @param regex
@@ -202,7 +200,7 @@ public class BundlesTests {
/**
* Tests if the file is owned by the bundle
- *
+ *
* @param filepath
* the file path
*/
@@ -337,7 +335,7 @@ public class BundlesTests {
}
/**
- *
+ *
* @param first
* @param second
* @return <ul>
@@ -365,7 +363,7 @@ public class BundlesTests {
}
/**
- *
+ *
* @param partialDependencyName
* the fullName or a part of the name of the plugin
* @param wantedBundleVersionRegex
@@ -420,10 +418,9 @@ public class BundlesTests {
/**
* This test verify that the plugin contains pdoc file
*/
+ @NotImplemented("Documentation file is not mandatory")
@Test
public void documentationFileTest() {
- Assume.assumeTrue("It is a good practice to add a plugin.pdoc file to each plug-in", TestMode.isStrict());
-
String message = null;
int nb = 0;
for(final Bundle bundle : BundleTestsUtils.getPapyrusBundles()) {
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
index d2d3e4b59c6..ee6096aa813 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
@@ -36,11 +36,11 @@ import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.ResetStyleHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
-import org.eclipse.papyrus.junit.utils.TestMode;
+import org.eclipse.papyrus.junit.utils.classification.NotImplemented;
+import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
import org.eclipse.uml2.uml.NamedElement;
import org.junit.After;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
@@ -49,9 +49,9 @@ import org.junit.Test;
* See resources/model/compartmentsTest/model.di for details
*
* @author Camille Letavernier
- *
+ *
*/
-public class CSSCompartmentsTests {
+public class CSSCompartmentsTests extends AbstractPapyrusTest {
public static final String CLASS_ATTRIBUTE_COMPARTMENT_TYPE = "7017"; //$NON-NLS-1$
@@ -111,9 +111,9 @@ public class CSSCompartmentsTests {
}
/* Test Enumeration1 */
+ @NotImplemented("The 'case insensitive' attributes are not supported by Eclipse E4 CSS")
@Test
public void testCaseInsensitiveForEnumeration() {
- Assume.assumeTrue("The 'case insensitive' attributes are not supported by Eclipse E4 CSS", TestMode.isStrict());
Shape enumeration = findShape("Enumeration1");
BasicCompartment compartment = findCompartment(enumeration, ENUMERATION_LITERAL_COMPARTMENT_TYPE);
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
index 51d7e76ea04..eaf7e42ec47 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
@@ -15,8 +15,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
org.eclipse.papyrus.editor;bundle-version="1.0.0",
org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.junit.utils,
+ org.eclipse.papyrus.junit.utils.classification,
org.eclipse.papyrus.junit.utils.rules,
org.eclipse.papyrus.junit.utils.tests
Bundle-Vendor: %Bundle-Vendor
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java
deleted file mode 100644
index 1cfcfb95686..00000000000
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.junit.utils;
-
-
-
-/**
- * This class is used to configure a test job. In strict mode, all tests are executed.
- * When the strict mode is disabled, the tests which are known to be failing are ignored.
- *
- * This is useful for test-driven development, when tests are implemented before the feature:
- * we can still have "green builds" (by ignoring these specific tests) and test for non-regression.
- *
- * Usage: When a test is known to be failing, add: Assume.assumeTrue("Why the test is disabled", TestMode.isStrict());
- *
- * The test will be run only in strict mode, and ignored during non-regression testing
- *
- * @author Camille Letavernier
- *
- */
-public class TestMode {
-
- private static boolean strictMode = false;
-
- public static boolean isStrict() {
- return strictMode;
- }
-
- public static void setStrict(boolean strictMode) {
- TestMode.strictMode = strictMode;
- }
-
-}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationConfig.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationConfig.java
new file mode 100644
index 00000000000..b22bfe95356
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationConfig.java
@@ -0,0 +1,141 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.classification;
+
+import static org.eclipse.papyrus.junit.utils.classification.TestCategory.InvalidTest;
+import static org.eclipse.papyrus.junit.utils.classification.TestCategory.NotImplemented;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.papyrus.infra.tools.util.ListHelper;
+
+
+/**
+ * This class is used to configure the Classification Annotations which should be
+ * excluded from a test job.
+ *
+ * Usage:
+ *
+ * ClassificationConfig.setExcludedTestCategories(TestCategory.InvalidTest, TestCategory.NotImplemented);
+ *
+ * or
+ *
+ * ClassificationConfig.setIncludedTestCategories(TestCategory.Standard, TestCategory.NotImplemented);
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ClassificationConfig {
+
+ public static final Set<TestCategory> excludedTestCategories = new HashSet<TestCategory>();
+
+ static {
+ setExcludedTestCategories(NotImplemented, InvalidTest);
+ }
+
+ /**
+ * Define the test categories which should be excluded from the TestSuite
+ *
+ * @param categoriesToInclude
+ */
+ public static void setExcludedTestCategories(TestCategory... categories) {
+ setExcludedTestCategories(Arrays.asList(categories));
+ }
+
+ /**
+ * Define the test categories which should be included in the TestSuite
+ *
+ * @param categoriesToInclude
+ */
+ public static void setIncludedTestCategories(TestCategory... categories) {
+ setIncludedTestCategories(Arrays.asList(categories));
+ }
+
+ /**
+ * Define the test categories which should be excluded from the TestSuite
+ *
+ * @param categoriesToInclude
+ */
+ public static void setExcludedTestCategories(Collection<TestCategory> categoriesToExclude) {
+ excludedTestCategories.clear();
+ excludedTestCategories.addAll(categoriesToExclude);
+ }
+
+ /**
+ * Define the test categories which should be included in the TestSuite
+ *
+ * @param categoriesToInclude
+ */
+ public static void setIncludedTestCategories(Collection<TestCategory> categoriesToInclude) {
+ excludedTestCategories.clear();
+ List<TestCategory> categoriesToExclude = ListHelper.asList(TestCategory.values());
+ categoriesToExclude.removeAll(categoriesToInclude);
+ excludedTestCategories.addAll(categoriesToExclude);
+ }
+
+ /**
+ * Tests whether a method containing the given set of Annotations should be executed
+ *
+ * @param annotations
+ * The annotations applied to the Method
+ * @return
+ * True if the test method should be executed, false if it should be ignored
+ */
+ public static boolean shouldRun(Annotation[] annotations) {
+ for(Annotation annotation : annotations) {
+ Class<? extends Annotation> annotationClass = annotation.annotationType();
+ if(isExcluded(annotationClass)) {
+ return false;
+ }
+ }
+
+ if(excludedTestCategories.contains(TestCategory.Standard)) {
+ for(TestCategory testCategory : TestCategory.values()) {
+ if(testCategory == TestCategory.Standard) {
+ continue;
+ }
+
+ for(Annotation annotation : annotations) {
+ if(testCategory.match(annotation.annotationType())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Tests whether the given Annotation should be excluded
+ *
+ * @param annotationClass
+ * @return
+ */
+ public static boolean isExcluded(Class<? extends Annotation> annotationClass) {
+ for(TestCategory testCategory : excludedTestCategories) {
+ if(testCategory.match(annotationClass)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationRule.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationRule.java
new file mode 100644
index 00000000000..f46248c6654
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/ClassificationRule.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.classification;
+
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * This rule must be used with Classification annotations
+ *
+ * @author Camille Letavernier
+ *
+ * @see {@link InvalidTest}
+ * @see {@link NotImplemented}
+ *
+ */
+public class ClassificationRule implements MethodRule {
+
+ public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ if(ClassificationConfig.shouldRun(method.getAnnotations())) {
+ System.out.println("Do run");
+ base.evaluate();
+ } else {
+ System.out.println("Skip "+method.getName());
+ }
+ }
+ };
+ }
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/InvalidTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/InvalidTest.java
new file mode 100644
index 00000000000..625726d7239
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/InvalidTest.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.classification;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that a test may fail because it is not properly implemented
+ * (e.g. not compatible with Hudson, because it opens some blocking dialogs)
+ *
+ * This annotation must be used with the {@link ClassificationRule}
+ *
+ * @author Camille Letavernier
+ *
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface InvalidTest {
+
+ /**
+ * A specific message explaining why this test may be invalid
+ *
+ * @return
+ */
+ String value() default "";
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/NotImplemented.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/NotImplemented.java
new file mode 100644
index 00000000000..ab51c1ae20b
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/NotImplemented.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.classification;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that a test may fail because the tested feature
+ * is not yet implemented (Test-driven development)
+ *
+ * This annotation must be used with the {@link ClassificationRule}
+ *
+ * @author Camille Letavernier
+ *
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NotImplemented {
+
+ /**
+ * A specific message explaining what needs to be implemented
+ * for this test to run
+ *
+ * @return
+ */
+ String value() default "";
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/TestCategory.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/TestCategory.java
new file mode 100644
index 00000000000..1ac992884da
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/classification/TestCategory.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.classification;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Enumerates all available TestCategories
+ *
+ * @author Camille Letavernier
+ *
+ */
+public enum TestCategory {
+
+ /**
+ * Test methods annotated with {@link NotImplemented}
+ */
+ NotImplemented(NotImplemented.class),
+
+ /**
+ * Test methods annotated with {@link InvalidTest}
+ */
+ InvalidTest(InvalidTest.class),
+
+ /**
+ * Test methods without any classification-related annotation
+ */
+ Standard();
+
+ private Class<? extends Annotation> annotationClass;
+
+ private TestCategory() {
+ //Empty constructor for Standard
+ }
+
+ private TestCategory(Class<? extends Annotation> annotationClass) {
+ this.annotationClass = annotationClass;
+ }
+
+ public boolean match(Class<? extends Annotation> annotationClass) {
+ return annotationClass == this.annotationClass;
+ }
+
+}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
index a5f4b1ccb65..fc071fb82b4 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,14 +31,14 @@ import org.junit.Assert;
import org.osgi.framework.Bundle;
-public abstract class AbstractEditorTest {
+public abstract class AbstractEditorTest extends AbstractPapyrusTest {
protected IMultiDiagramEditor editor;
protected IProject project;
/**
- *
+ *
* @return
* the current bundle
*/
@@ -49,7 +49,7 @@ public abstract class AbstractEditorTest {
/**
* Inits this.editor
* Fails or throws an exception if an error occurs
- *
+ *
* @param bundle
* TODO
*/
@@ -108,7 +108,7 @@ public abstract class AbstractEditorTest {
/**
* The path to the source model folder
- *
+ *
* @return
*/
protected abstract String getSourcePath();
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractPapyrusTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractPapyrusTest.java
new file mode 100644
index 00000000000..bc7309ec510
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractPapyrusTest.java
@@ -0,0 +1,27 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.tests;
+
+import org.eclipse.papyrus.junit.utils.classification.ClassificationRule;
+import org.junit.Rule;
+
+/**
+ * An abstract class which should be extended by all Papyrus tests
+ *
+ * @author Camille Letavernier
+ *
+ */
+public abstract class AbstractPapyrusTest {
+
+ @Rule
+ public final ClassificationRule classification = new ClassificationRule();
+}
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
index 36d89cc8e52..8a9935779f1 100644
--- a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
@@ -23,7 +23,7 @@ import org.eclipse.papyrus.infra.emf.resource.DependencyManagementHelper;
import org.eclipse.papyrus.junit.utils.ModelUtils;
import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
import org.eclipse.papyrus.junit.utils.ProjectUtils;
-import org.eclipse.papyrus.junit.utils.TestMode;
+import org.eclipse.papyrus.junit.utils.classification.NotImplemented;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.tools.tests.Activator;
import org.eclipse.uml2.uml.Model;
@@ -32,16 +32,15 @@ import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
/**
* Test case for DependencyManagementHelper
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class DependencyManagementTest extends AbstractEditorTest {
@@ -111,9 +110,8 @@ public class DependencyManagementTest extends AbstractEditorTest {
//Problem: !!Stereotypes are not references!! They are instances. After the switch, the new
//profile is correctly applied, but the applied Stereotypes are the ones from the initial Profile
@Test
+ @NotImplemented("Bug 408491 is not yet implemented")
public void testSwitchProfilesWithStereotypes() throws Exception {
- Assume.assumeTrue("Bug 408491 is not yet implemented", TestMode.isStrict());
-
IProject project = ProjectUtils.createProject("dependencyManagement.switchProfiles");
PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), "profiles/model");
PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), "profiles/p1/profile1.profile");

Back to the top