Class ActiveObjectsJUnitRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
net.java.ao.test.junit.ActiveObjectsJUnitRunner
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

public final class ActiveObjectsJUnitRunner extends org.junit.runners.BlockJUnit4ClassRunner
A JUnit test runner that provides helpful behavior for tests that rely on ActiveObjects.

Before each test method is executed, the test runner creates an EntityManager instance and injects it into the test class; the test class (or a superclass) must have a member field of type EntityManager for this purpose. The EntityManager configuration is based on the test class annotations @Jdbc, @Data and @NameConverters; in the absence of these annotations, the default configuration uses an in-memory HSQL database.

By default, each test method is executed within a separate transaction, which is then rolled back so the next test is executed with a fresh database state. If you annotate a test method with @NonTransactional, then it is not executed inside a transaction; instead, the database is completely reinitialized after executing the test.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<org.junit.rules.MethodRule>
    rules(Object test)
     

    Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

    collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout

    Methods inherited from class org.junit.runners.ParentRunner

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

    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
  • Constructor Details

    • ActiveObjectsJUnitRunner

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

    • rules

      protected List<org.junit.rules.MethodRule> rules(Object test)
      Overrides:
      rules in class org.junit.runners.BlockJUnit4ClassRunner