Class SilverTestEnvContext
java.lang.Object
org.silverpeas.kernel.test.extension.SilverTestEnvContext
Context of the Silverpeas testing environment enabled by the
EnableSilverTestEnv Junit extension. Such context is
a way to customize the environment.- Author:
- mmoquillon
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classExecution context of a given test. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidExecute some actions to perform once the execution of a unit test has been completed.abstract voidExecute some actions to perform before the execution of a unit test.abstract voidclear()Clears the test environment context.Gets the classes of the beans to preload into the IoC/IoD subsystem used in the tests.Gets the mocks to preload into the IoC/IoD subsystem used in the tests.abstract voidinit()Initializes the test environment context.
-
Field Details
-
DEFAULT_CONTEXT
Default test context.
-
-
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 theEnableSilverTestEnvannotation once this one is bootstrapped and initialized. The initialization is done once theSystemPropertiesandSystemPropertyannotations are processed so that any additional properties can be found fromSystemWrapperby the context for its initialization. -
beforeTest
Execute some actions to perform before the execution of a unit test.- Parameters:
context- the execution context of the current test.
-
afterTest
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
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
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 theirPostConstructannotated methods will be invoked and their dependencies satisfied (by mock unless there is a bean available in theBeanContainerand 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.
-