Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/framework/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/IgnoreRunner.java')
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/IgnoreRunner.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/junit/framework/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/IgnoreRunner.java b/tests/junit/framework/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/IgnoreRunner.java
new file mode 100644
index 00000000000..26a6bdf9f80
--- /dev/null
+++ b/tests/junit/framework/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/IgnoreRunner.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * 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:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.junit.framework.runner;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.util.AbstractTreeIterator;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+
+/**
+ * A JUnit runner that just ignores all of the leaves of its {@link #getDescription() description} tree.
+ */
+public class IgnoreRunner extends Runner {
+ private final Description description;
+
+ /**
+ * Initializes me with the test suite that I ignore.
+ */
+ public IgnoreRunner(Description testSuite) {
+ super();
+
+ this.description = testSuite;
+ }
+
+ @Override
+ public Description getDescription() {
+ return description;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ for (Iterator<Description> iter = iterator(); iter.hasNext();) {
+ Description next = iter.next();
+ if (next.isTest()) {
+ notifier.fireTestIgnored(next);
+ }
+ }
+ }
+
+ TreeIterator<Description> iterator() {
+ return new AbstractTreeIterator<Description>(getDescription()) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected Iterator<? extends Description> getChildren(Object object) {
+ return ((Description) object).getChildren().iterator();
+ }
+ };
+ }
+}

Back to the top