public class InjectingAnnotationEngine extends java.lang.Object implements AnnotationEngine, AnnotationEngine
Modifier and Type | Field and Description |
---|---|
private AnnotationEngine |
delegate |
private AnnotationEngine |
spyAnnotationEngine |
Constructor and Description |
---|
InjectingAnnotationEngine() |
Modifier and Type | Method and Description |
---|---|
void |
injectMocks(java.lang.Object testClassInstance)
Initializes mock/spies dependencies for objects annotated with
@InjectMocks for given testClassInstance.
|
protected void |
onInjection(java.lang.Object testClassInstance,
java.lang.Class<?> clazz,
java.util.Set<java.lang.reflect.Field> mockDependentFields,
java.util.Set<java.lang.Object> mocks) |
void |
process(java.lang.Class<?> clazz,
java.lang.Object testInstance)
Process the fields of the test instance and create Mocks, Spies, Captors and inject them on fields
annotated @InjectMocks.
|
private void |
processIndependentAnnotations(java.lang.Class<?> clazz,
java.lang.Object testInstance) |
private void |
processInjectMocks(java.lang.Class<?> clazz,
java.lang.Object testInstance) |
private final AnnotationEngine delegate
private final AnnotationEngine spyAnnotationEngine
public void process(java.lang.Class<?> clazz, java.lang.Object testInstance)
This code process the test class and the super classes.
process
in interface AnnotationEngine
clazz
- Not usedtestInstance
- The instance of the test, should not be null.AnnotationEngine.process(Class, Object)
private void processInjectMocks(java.lang.Class<?> clazz, java.lang.Object testInstance)
private void processIndependentAnnotations(java.lang.Class<?> clazz, java.lang.Object testInstance)
public void injectMocks(java.lang.Object testClassInstance)
See examples in javadoc for MockitoAnnotations
class.
testClassInstance
- Test class, usually this
protected void onInjection(java.lang.Object testClassInstance, java.lang.Class<?> clazz, java.util.Set<java.lang.reflect.Field> mockDependentFields, java.util.Set<java.lang.Object> mocks)