]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixing modelled STS tests to not include nested JUnit suites 13/213/1
authorjsimomaa <jani.simomaa@vtt.fi>
Mon, 19 Dec 2016 14:48:34 +0000 (16:48 +0200)
committerjsimomaa <jani.simomaa@vtt.fi>
Mon, 19 Dec 2016 14:48:34 +0000 (16:48 +0200)
refs #6884

Change-Id: I314f591d33bb06504f875b14041f12edc4dedb71

bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSSuiteRunner.java
bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeSTSTestRunner.java
bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/junit/RuntimeTestCollector.java

index 70325319dcb25a0cb851f3c16c544a3958a6baa5..a02c69e85466f8c9fb31229794bb18dcecac7bf6 100644 (file)
@@ -5,20 +5,19 @@ import java.util.Collection;
 import java.util.List;\r
 \r
 import org.junit.runner.Description;\r
-import org.junit.runner.Runner;\r
 import org.simantics.scl.compiler.commands.CommandSession;\r
 import org.simantics.scl.osgi.SCLOsgi;\r
 \r
-public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner {\r
+public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner<RuntimeSTSTestRunner> {\r
 \r
     private final List<RuntimeSTSTestRunner> children = new ArrayList<>();\r
     private final String suiteName;\r
 \r
-    RuntimeSTSSuiteRunner(String suiteName) throws Exception {\r
-        super(RuntimeSTSSuiteRunner.class);\r
+    protected RuntimeSTSSuiteRunner(Class<?> clazz, String suiteName) throws Exception {\r
+        super(clazz);\r
         this.suiteName = suiteName;\r
     }\r
-    \r
+\r
     @Override\r
     protected String getName() {\r
         return suiteName;\r
@@ -36,19 +35,18 @@ public class RuntimeSTSSuiteRunner extends RuntimeSTSRunner {
         testChildren.forEach(c -> c.setCommandSession(session));\r
         children.addAll(testChildren);\r
     }\r
-    \r
-    @SuppressWarnings({ "unchecked", "rawtypes" })\r
+\r
     @Override\r
-    protected List<Runner> getChildren() {\r
-        return (List) children;\r
+    public List<RuntimeSTSTestRunner> getChildren() {\r
+        return children;\r
     }\r
 \r
     @Override\r
-    public void initialize() {\r
+    public void initialize() throws Exception {\r
     }\r
 \r
     @Override\r
-    public void deinitialize() {\r
+    public void deinitialize() throws Exception {\r
     }\r
 \r
 }\r
index a80b84e750f7dbe413b255b5a2527d7dc49dc139..c0a5ac342d4ec56a40146ed5f1164a7c62739c82 100644 (file)
@@ -66,4 +66,5 @@ public class RuntimeSTSTestRunner extends Runner {
     public Integer getPriority() {\r
         return priority;\r
     }\r
-}\r
+\r
+}
\ No newline at end of file
index 81d1ef7e7f52d7a961df8c53a2918f6b332e7382..06b81687ec025f1cc17a1bbf5cbb0dbf8155589f 100644 (file)
@@ -7,7 +7,6 @@ import java.util.HashSet;
 import java.util.List;\r
 import java.util.Set;\r
 \r
-import org.junit.runner.Runner;\r
 import org.simantics.Simantics;\r
 import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
@@ -50,7 +49,7 @@ public class RuntimeTestCollector {
                                 if (tests.isEmpty())\r
                                     continue;\r
     \r
-                                RuntimeSTSSuiteRunner suite = new RuntimeSTSSuiteRunner(suiteName);\r
+                                RuntimeSTSSuiteRunner suite = new RuntimeSTSSuiteRunner(RuntimeSTSSuiteRunner.class, suiteName);\r
                                 List<RuntimeSTSTestRunner> testRunners = new ArrayList<>();\r
                                 for (Resource test : tests) {\r
                                     String testName = graph.getRelatedValue(test, L0.HasName, Bindings.STRING);\r
@@ -83,7 +82,7 @@ public class RuntimeTestCollector {
         }\r
     }\r
 \r
-    public static List<Runner> collectTests() {\r
+    public static List<RuntimeSTSSuiteRunner> collectTests() {\r
         return new ArrayList<>(collectTestsFromGraph());\r
     }\r
 }\r