public class MockStrategiesHelper extends Object
| Constructor and Description |
|---|
MockStrategiesHelper(ApplicationContext applicationContext)
Creates a new instance of the
MockStrategiesHelper with the given application context. |
| Modifier and Type | Method and Description |
|---|---|
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(ApplicationContext applicationContext)
MockStrategiesHelper with the given application context.applicationContext - the application contextpublic 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 foundBeanInitializationException - 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 foundBeanInitializationException - if there is more than 1 beans of the given type