public class ConstructorInjection extends MockInjectionStrategy
The strategy will search for the constructor with most parameters and try to resolve mocks by type.
TODO on missing mock type, shall it abandon or create "noname" mocks. TODO and what if the arg type is not mockable.
For now the algorithm tries to create anonymous mocks if an argument type is missing. If not possible the algorithm abandon resolution.
| Constructor and Description |
|---|
ConstructorInjection() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
processInjection(java.lang.reflect.Field field,
java.lang.Object fieldOwner,
java.util.Set<java.lang.Object> mockCandidates)
Process actual injection.
|
nop, process, thenTrypublic boolean processInjection(java.lang.reflect.Field field,
java.lang.Object fieldOwner,
java.util.Set<java.lang.Object> mockCandidates)
MockInjectionStrategy
Don't call this method directly, instead call MockInjectionStrategy.process(Field, Object, Set)
processInjection in class MockInjectionStrategyfield - Field needing injectionfieldOwner - Field owner instance.mockCandidates - Pool of mocks to inject.true if injection occurred, false otherwise