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 and Description |
---|
PropertyAndSetterInjection() |
Modifier and Type | Method and Description |
---|---|
boolean |
processInjection(Field injectMocksField,
Object injectMocksFieldOwner,
Set<Object> mockCandidates)
Process actual injection.
|
nop, process, thenTry
public boolean processInjection(Field injectMocksField, Object injectMocksFieldOwner, Set<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
otherwiseMockito, MIT License