Class SilverTestEnvContext

java.lang.Object
org.silverpeas.kernel.test.extension.SilverTestEnvContext

public abstract class SilverTestEnvContext extends Object
Context of the Silverpeas testing environment enabled by the EnableSilverTestEnv Junit extension. Such context is a way to customize the environment.
Author:
mmoquillon
  • Field Details

  • Constructor Details

    • SilverTestEnvContext

      public SilverTestEnvContext()
  • Method Details

    • init

      public abstract void init()
      Initializes the test environment context. This method is usually invoked by the Silverpeas unit test environment that was enabled with the EnableSilverTestEnv annotation once this one is bootstrapped and initialized. The initialization is done once the SystemProperties and SystemProperty annotations are processed so that any additional properties can be found from SystemWrapper by the context for its initialization.
    • beforeTest

      public abstract void beforeTest(SilverTestEnvContext.TestExecutionContext context)
      Execute some actions to perform before the execution of a unit test.
      Parameters:
      context - the execution context of the current test.
    • afterTest

      public abstract void afterTest(SilverTestEnvContext.TestExecutionContext context)
      Execute some actions to perform once the execution of a unit test has been completed.
      Parameters:
      context - the execution context of the current test.
    • getMocksToManage

      @NonNull public abstract List<Object> getMocksToManage()
      Gets the mocks to preload into the IoC/IoD subsystem used in the tests.
      Returns:
      a non-null list of already preconfigured mocks to manage for the unit tests.
    • getBeansToManage

      @NonNull public abstract List<Class<?>> getBeansToManage()
      Gets the classes of the beans to preload into the IoC/IoD subsystem used in the tests. Theses beans will be managed by the IoC/IoD subsystem, meaning their PostConstruct annotated methods will be invoked and their dependencies satisfied (by mock unless there is a bean available in the BeanContainer and satisfying the dependency).
      Returns:
      a non-null list of classes of beans to manage for the unit tests.
    • clear

      public abstract void clear()
      Clears the test environment context.