Search in sources :

Example 46 with Runner

use of org.junit.runner.Runner in project ceylon-compiler by ceylon.

the class CeylonModuleRunner method makeModuleRunnerInNewJvm.

private void makeModuleRunnerInNewJvm(final ModuleSpecifier module) {
    final Description description = Description.createTestDescription(getClass(), "Run " + module.module() + " in new JVM");
    Runner runner = new Runner() {

        @Override
        public Description getDescription() {
            return description;
        }

        @Override
        public void run(RunNotifier notifier) {
            notifier.fireTestStarted(description);
            try {
                String moduleName = module.module();
                String version = Module.DEFAULT_MODULE_NAME.equals(moduleName) ? null : module.version();
                String runClass = module.runClass();
                if (runClass.isEmpty())
                    runClass = moduleName + ".run_";
                runModuleInNewJvm(moduleName, version, runClass);
            } catch (Exception x) {
                x.printStackTrace();
                notifier.fireTestFailure(new Failure(description, x));
            }
            notifier.fireTestFinished(description);
        }
    };
    children.put(runner, description);
}
Also used : Runner(org.junit.runner.Runner) ParentRunner(org.junit.runners.ParentRunner) Description(org.junit.runner.Description) RunNotifier(org.junit.runner.notification.RunNotifier) URISyntaxException(java.net.URISyntaxException) MalformedURLException(java.net.MalformedURLException) Failure(org.junit.runner.notification.Failure)

Aggregations

Runner (org.junit.runner.Runner)46 Test (org.junit.Test)20 Description (org.junit.runner.Description)9 JUnitCore (org.junit.runner.JUnitCore)9 Request (org.junit.runner.Request)8 Result (org.junit.runner.Result)7 ArrayList (java.util.ArrayList)6 Filter (org.junit.runner.manipulation.Filter)6 NoTestsRemainException (org.junit.runner.manipulation.NoTestsRemainException)6 ParentRunner (org.junit.runners.ParentRunner)6 RunnerSpy (org.junit.runner.RunnerSpy)5 Failure (org.junit.runner.notification.Failure)5 RunNotifier (org.junit.runner.notification.RunNotifier)5 Method (java.lang.reflect.Method)4 JUnit38ClassRunner (org.junit.internal.runners.JUnit38ClassRunner)4 InitializationError (org.junit.runners.model.InitializationError)4 ErrorReportingRunner (org.junit.internal.runners.ErrorReportingRunner)3 LinkedList (java.util.LinkedList)2 SuiteMethod (org.junit.internal.runners.SuiteMethod)2 Computer (org.junit.runner.Computer)2