package org.simantics.tests.modelled.junit; import org.junit.runner.Description; import org.junit.runner.Result; import org.junit.runner.Runner; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; import org.junit.runners.ParentRunner; @Deprecated public abstract class RuntimeSTSRunner extends ParentRunner { public RuntimeSTSRunner(Class testClass) throws Exception { super(testClass); } public abstract void initialize() throws Exception; public abstract void deinitialize() throws Exception; @Override protected Description describeChild(Runner child) { return child.getDescription(); } @Override public void run(RunNotifier notifier) { notifier.addListener(new RunListener() { @Override public void testRunFinished(Result result) throws Exception { deinitialize(); } }); super.run(notifier); } @Override protected void runChild(Runner child, RunNotifier notifier) { Description desc = describeChild(child); notifier.fireTestStarted(desc); try { child.run(notifier); notifier.fireTestFinished(desc); } catch (Throwable e) { notifier.fireTestFailure(new Failure(desc, e)); } } }