Package org.apache.struts2.mock
Class MockContainer
java.lang.Object
org.apache.struts2.mock.MockContainer
- All Implemented Interfaces:
- Serializable,- Container
Mock implementation to be used in unittests
- See Also:
- 
Field SummaryFields inherited from interface org.apache.struts2.inject.ContainerDEFAULT_NAME
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<T> TgetInstance(Class<T> type) Convenience method. Equivalent togetInstance(type, DEFAULT_NAME).<T> TgetInstance(Class<T> type, String name) Gets an instance of the given dependency which was declared inContainerBuilder.getInstanceNames(Class<?> type) Gets a set of all registered names for the given type<T> TCreates and injects a new instance of typeimplementation.voidInjects dependencies into the fields and methods of an existing object.voidRemoves the scope strategy for the current thread.voidsetScopeStrategy(Scope.Strategy scopeStrategy) Sets the scope strategy for the current thread.
- 
Constructor Details- 
MockContainerpublic MockContainer()
 
- 
- 
Method Details- 
injectDescription copied from interface:ContainerInjects dependencies into the fields and methods of an existing object.
- 
injectDescription copied from interface:ContainerCreates and injects a new instance of typeimplementation.
- 
getInstanceDescription copied from interface:ContainerGets an instance of the given dependency which was declared inContainerBuilder.- Specified by:
- getInstancein interface- Container
- Type Parameters:
- T- type
- Parameters:
- type- of dependency
- name- of dependency
- Returns:
- instance
 
- 
getInstanceDescription copied from interface:ContainerConvenience method. Equivalent togetInstance(type, DEFAULT_NAME).- Specified by:
- getInstancein interface- Container
- Type Parameters:
- T- type
- Parameters:
- type- of dependency
- Returns:
- instance
 
- 
getInstanceNamesDescription copied from interface:ContainerGets a set of all registered names for the given type- Specified by:
- getInstanceNamesin interface- Container
- Parameters:
- type- The instance type
- Returns:
- A set of registered names or empty set if no instances are registered for that type
 
- 
setScopeStrategyDescription copied from interface:ContainerSets the scope strategy for the current thread.- Specified by:
- setScopeStrategyin interface- Container
- Parameters:
- scopeStrategy- scope strategy
 
- 
removeScopeStrategypublic void removeScopeStrategy()Description copied from interface:ContainerRemoves the scope strategy for the current thread.- Specified by:
- removeScopeStrategyin interface- Container
 
 
-