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 with TestFactory 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 LinkedList<org.junit.runners.model.FrameworkMethod>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FactoryRunner(Class<?> clazz)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Collection<? extends org.junit.runners.model.FrameworkMethod>
     
    protected List<org.junit.runners.model.FrameworkMethod>
    protected void
     
    protected void
    This method overrides the original method validateInstanceMethods(...) of BlockJUnit4ClassRunner to avoid a crash of the JUnit test suite caused by adding FactoryTests 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

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • tests

      protected LinkedList<org.junit.runners.model.FrameworkMethod> tests
  • Constructor Details

    • FactoryRunner

      public FactoryRunner(Class<?> clazz) throws org.junit.runners.model.InitializationError
      Throws:
      org.junit.runners.model.InitializationError
  • Method Details

    • computeTests

      protected void computeTests() throws Exception
      Throws:
      Exception
    • computeFactoryTests

      protected Collection<? extends org.junit.runners.model.FrameworkMethod> computeFactoryTests() throws Exception
      Throws:
      Exception
    • computeTestMethods

      protected List<org.junit.runners.model.FrameworkMethod> computeTestMethods()
      Overrides:
      computeTestMethods in class org.junit.runners.BlockJUnit4ClassRunner
      See Also:
      • BlockJUnit4ClassRunner.computeTestMethods()
    • validateInstanceMethods

      protected void validateInstanceMethods(List<Throwable> errors)
      This method overrides the original method validateInstanceMethods(...) of BlockJUnit4ClassRunner to avoid a crash of the JUnit test suite caused by adding FactoryTests 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 class org.junit.runners.BlockJUnit4ClassRunner