From 4d7fd1da32ae9f61bc96111f0bb913f2eced5257 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Mon, 19 Dec 2016 16:48:34 +0200 Subject: [PATCH] Fixing modelled STS tests to not include nested JUnit suites refs #6884 Change-Id: I314f591d33bb06504f875b14041f12edc4dedb71 --- .../modelled/junit/RuntimeSTSSuiteRunner.java | 20 +++++++++---------- .../modelled/junit/RuntimeSTSTestRunner.java | 3 ++- .../modelled/junit/RuntimeTestCollector.java | 5 ++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSSuiteRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSSuiteRunner.java index 70325319d..a02c69e85 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSSuiteRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSSuiteRunner.java @@ -5,20 +5,19 @@ import java.util.Collection; import java.util.List; import org.junit.runner.Description; -import org.junit.runner.Runner; import org.simantics.scl.compiler.commands.CommandSession; import org.simantics.scl.osgi.SCLOsgi; -public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner { +public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner { private final List children = new ArrayList<>(); private final String suiteName; - RuntimeSTSSuiteRunner(String suiteName) throws Exception { - super(RuntimeSTSSuiteRunner.class); + protected RuntimeSTSSuiteRunner(Class clazz, String suiteName) throws Exception { + super(clazz); this.suiteName = suiteName; } - + @Override protected String getName() { return suiteName; @@ -36,19 +35,18 @@ public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner { testChildren.forEach(c -> c.setCommandSession(session)); children.addAll(testChildren); } - - @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override - protected List getChildren() { - return (List) children; + public List getChildren() { + return children; } @Override - public void initialize() { + public void initialize() throws Exception { } @Override - public void deinitialize() { + public void deinitialize() throws Exception { } } diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java index a80b84e75..c0a5ac342 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java @@ -66,4 +66,5 @@ public class RuntimeSTSTestRunner extends Runner { public Integer getPriority() { return priority; } -} + +} \ No newline at end of file diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java index 81d1ef7e7..06b81687e 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java @@ -7,7 +7,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.junit.runner.Runner; import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; @@ -50,7 +49,7 @@ public class RuntimeTestCollector { if (tests.isEmpty()) continue; - RuntimeSTSSuiteRunner suite = new RuntimeSTSSuiteRunner(suiteName); + RuntimeSTSSuiteRunner suite = new RuntimeSTSSuiteRunner(RuntimeSTSSuiteRunner.class, suiteName); List testRunners = new ArrayList<>(); for (Resource test : tests) { String testName = graph.getRelatedValue(test, L0.HasName, Bindings.STRING); @@ -83,7 +82,7 @@ public class RuntimeTestCollector { } } - public static List collectTests() { + public static List collectTests() { return new ArrayList<>(collectTestsFromGraph()); } } -- 2.47.1