Class FactoryRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- org.processmining.contexts.test.factory.FactoryRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Sortable
public class FactoryRunner extends org.junit.runners.BlockJUnit4ClassRunner
A helper method that can be used to modify how JUnit executes a test suite. Add annotation@RunWith(FactoryRunner.class)
to the JUnit test to hook this helper to the JUnit test suite. When executing the test suite with JUnit, all methods of the test suite that are annotated withTestFactory
will be executed before all other tests. Each of these methods dynamically adds a number of JUnit tests to the test suite.- Author:
- Ted Young
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedList<org.junit.runners.model.FrameworkMethod>
tests
-
Constructor Summary
Constructors Constructor Description FactoryRunner(java.lang.Class<?> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<? extends org.junit.runners.model.FrameworkMethod>
computeFactoryTests()
protected java.util.List<org.junit.runners.model.FrameworkMethod>
computeTestMethods()
protected void
computeTests()
protected void
validateInstanceMethods(java.util.List<java.lang.Throwable> errors)
This method overrides the original methodvalidateInstanceMethods(...)
ofBlockJUnit4ClassRunner
to avoid a crash of the JUnit test suite caused by addingFactoryTest
s to the test suite before pre-defined tests are loaded.-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
-
-
-
-
Method Detail
-
computeTests
protected void computeTests() throws java.lang.Exception
- Throws:
java.lang.Exception
-
computeFactoryTests
protected java.util.Collection<? extends org.junit.runners.model.FrameworkMethod> computeFactoryTests() throws java.lang.Exception
- Throws:
java.lang.Exception
-
computeTestMethods
protected java.util.List<org.junit.runners.model.FrameworkMethod> computeTestMethods()
- Overrides:
computeTestMethods
in classorg.junit.runners.BlockJUnit4ClassRunner
- See Also:
BlockJUnit4ClassRunner.computeTestMethods()
-
validateInstanceMethods
protected void validateInstanceMethods(java.util.List<java.lang.Throwable> errors)
This method overrides the original methodvalidateInstanceMethods(...)
ofBlockJUnit4ClassRunner
to avoid a crash of the JUnit test suite caused by addingFactoryTest
s to the test suite before pre-defined tests are loaded. The original method is marked@Deprecated
. TODO: Remove this overriding method once the original is removed from the JUnit framework.- Overrides:
validateInstanceMethods
in classorg.junit.runners.BlockJUnit4ClassRunner
-
-