public class TestServiceProxy extends LocalServiceProxy
mock(Class, Object)
and clear()
methods.Modifier and Type | Class and Description |
---|---|
protected class |
TestServiceProxy.ServiceInvocationHandler |
Constructor and Description |
---|
TestServiceProxy() |
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Clears all previously registered mocks.
|
static <T> T |
getDefault(java.lang.Class<T> serviceInterface)
Returns a default implementation of the given service interface.
|
java.lang.Object |
getObject() |
static <T> void |
mock(java.lang.Class<T> serviceInterface,
T mock)
Registers a mock implementation for the given service interface.
|
static <T> void |
setDefault(java.lang.Class<T> serviceInterface,
T defaultProxy)
Registers a default implementation for the given service interface which will be used if no mocks are specified.
|
afterPropertiesSet, getObjectType, getServiceName, isSingleton, setServiceName
getServiceInterface, setServiceInterface
public java.lang.Object getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean<java.lang.Object>
getObject
in class LocalServiceProxy
public static <T> void setDefault(java.lang.Class<T> serviceInterface, @Nullable T defaultProxy)
serviceInterface
- service interface, e.g. DataService
defaultProxy
- service implementation. If null, default implementation does nothing and returns null.mock(Class, Object)
@Nullable public static <T> T getDefault(java.lang.Class<T> serviceInterface)
serviceInterface
- service interface, e.g. DataService
public static <T> void mock(java.lang.Class<T> serviceInterface, @Nullable T mock)
serviceInterface
- service interface, e.g. DataService
mock
- mock implementation. If null, the default implementation will be used.clear()
public static void clear()
mock(Class, Object)