Class ConstructorInjection
java.lang.Object
org.mockito.internal.configuration.injection.MockInjectionStrategy
org.mockito.internal.configuration.injection.ConstructorInjection
Injection strategy based on constructor.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprocessInjection(Field field, Object fieldOwner, Set<Object> mockCandidates) Process actual injection.Methods inherited from class org.mockito.internal.configuration.injection.MockInjectionStrategy
nop, process, thenTry
-
Constructor Details
-
ConstructorInjection
public ConstructorInjection()
-
-
Method Details
-
processInjection
Description copied from class:MockInjectionStrategyProcess actual injection.Don't call this method directly, instead call
MockInjectionStrategy.process(Field, Object, Set)- Specified by:
processInjectionin classMockInjectionStrategy- Parameters:
field- Field needing injectionfieldOwner- Field owner instance.mockCandidates- Pool of mocks to inject.- Returns:
trueif injection occurred,falseotherwise
-