public class InjectionMock extends Object
| Constructor and Description |
|---|
InjectionMock() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMock(String fieldName,
Object mock,
Class<?> targetType)
add the given mock to the list of available mocks
|
void |
addMock(String fieldName,
Object mock,
Class<?> targetType,
String qualifier)
add the given mock to the list of available mocks
|
<T> T |
getMock(Class<T> clazz)
retrieve the mock for the given target class
|
<T> T |
getMock(Class<T> clazz,
String qualifier)
retrieve the mock for the given target class
|
Object |
getMock(String field)
retrieve the mock for the given field or null if none present
|
public void addMock(String fieldName, Object mock, Class<?> targetType)
fieldName - the name of the field the mock was injected intomock - the mock object itselftargetType - the type of the field the mock was injected intopublic void addMock(String fieldName, Object mock, Class<?> targetType, String qualifier)
fieldName - the name of the field the mock was injected intomock - the mock object itselftargetType - the type of the field the mock was injected intoqualifier - the qualifier of the field the mock was injected intopublic Object getMock(String field)
field - the field namepublic <T> T getMock(Class<T> clazz)
T - class parameter to get casted mock objectclazz - the class of the field the mock was injected intopublic <T> T getMock(Class<T> clazz, String qualifier)
T - class parameter to get casted mock objectclazz - the class of the field the mock was injected intoqualifier - the qualifier of the field the mock was injected intoCopyright © 2016–2023 Taimos GmbH. All rights reserved.