Search in sources :

Example 1 with BlockJUnit4ClassRunnerWithParametersFactory

use of org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParametersFactory in project Main by SpartanRefactoring.

the class MetaTester method runChild.

@Override
@SuppressWarnings("unused")
protected void runChild(final FrameworkMethod __, final RunNotifier n) {
    if (hasRan)
        return;
    final Class<?> newTestClass = new ASTTestClassGenerator(testClass).generate(testClass.getSimpleName() + "_Meta", sourceFile);
    final TestSuite suite = new TestSuite(newTestClass);
    suite.run(new TestResult());
    try {
        new BlockJUnit4ClassRunnerWithParametersFactory().createRunnerForTestWithParameters(new TestWithParameters(" ", new TestClass(newTestClass), an.empty.list())).run(n);
    } catch (final InitializationError ignore) {
    /**/
    }
    // Uncomment this to run the original test as well
    /* super.runChild(method, notifier); */
    hasRan = true;
}
Also used : TestWithParameters(org.junit.runners.parameterized.TestWithParameters) TestSuite(junit.framework.TestSuite) InitializationError(org.junit.runners.model.InitializationError) TestResult(junit.framework.TestResult) BlockJUnit4ClassRunnerWithParametersFactory(org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParametersFactory) TestClass(org.junit.runners.model.TestClass)

Aggregations

TestResult (junit.framework.TestResult)1 TestSuite (junit.framework.TestSuite)1 InitializationError (org.junit.runners.model.InitializationError)1 TestClass (org.junit.runners.model.TestClass)1 BlockJUnit4ClassRunnerWithParametersFactory (org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParametersFactory)1 TestWithParameters (org.junit.runners.parameterized.TestWithParameters)1