public class PropertyAndSetterInjection extends MockInjectionStrategy
Algorithm :
for each field annotated by @InjectMocks
Note: If the field needing injection is not initialized, the strategy tries to create one using a no-arg constructor of the field type.
Constructor | Description |
---|---|
PropertyAndSetterInjection() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
processInjection(java.lang.reflect.Field injectMocksField,
java.lang.Object injectMocksFieldOwner,
java.util.Set<java.lang.Object> mockCandidates) |
Process actual injection.
|
nop, process, thenTry
public boolean processInjection(java.lang.reflect.Field injectMocksField, java.lang.Object injectMocksFieldOwner, java.util.Set<java.lang.Object> mockCandidates)
MockInjectionStrategy
Don't call this method directly, instead call MockInjectionStrategy.process(Field, Object, Set)
processInjection
in class MockInjectionStrategy
injectMocksField
- Field needing injectioninjectMocksFieldOwner
- Field owner instance.mockCandidates
- Pool of mocks to inject.true
if injection occurred, false
otherwise