From: jsimomaa Date: Mon, 19 Dec 2016 14:48:34 +0000 (+0200) Subject: Fixing modelled STS tests to not include nested JUnit suites X-Git-Tag: v1.26.0~23 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=4d7fd1da32ae9f61bc96111f0bb913f2eced5257;p=simantics%2Fplatform.git Fixing modelled STS tests to not include nested JUnit suites refs #6884 Change-Id: I314f591d33bb06504f875b14041f12edc4dedb71 --- 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()); } }