public class MockStrategiesHelper extends Object
| Constructor and Description |
|---|
MockStrategiesHelper(org.springframework.context.ApplicationContext applicationContext)
Creates a new instance of the
MockStrategiesHelper with the given application context. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.context.ApplicationContext |
getApplicationContext()
Returns the application context.
|
<T> T |
getStrategy(Class<T> type)
Returns a single strategy found in the given application context.
|
<T,D extends T> |
getStrategy(Class<T> type,
Class<D> defaultType)
Returns a single strategy found in the given application context, or instantiates a default strategy if no
applicable strategy was found.
|
public MockStrategiesHelper(org.springframework.context.ApplicationContext applicationContext)
MockStrategiesHelper with the given application context.applicationContext - the application contextpublic org.springframework.context.ApplicationContext getApplicationContext()
public <T> T getStrategy(Class<T> type)
type - the type of bean to be found in the application contextnull if no bean of the given type can be foundorg.springframework.beans.factory.BeanInitializationException - if there is more than 1 beans of the given typepublic <T,D extends T> T getStrategy(Class<T> type, Class<D> defaultType)
type - the type of bean to be found in the application contextdefaultType - the type to instantiate and return when no bean of the specified type could be foundorg.springframework.beans.factory.BeanInitializationException - if there is more than 1 beans of the given type