public class SpyAnnotationEngine extends Object implements AnnotationEngine
Will try transform the field in a spy as with Mockito.spy().
If the field is not initialized, will try to initialize it, with a no-arg constructor.
If the field is also annotated with the compatible @InjectMocks then the field will be ignored, The injection engine will handle this specific case.
This engine will fail, if the field is also annotated with incompatible Mockito annotations.
| Constructor and Description |
|---|
SpyAnnotationEngine() |
| Modifier and Type | Method and Description |
|---|---|
Object |
createMockFor(Annotation annotation,
Field field) |
void |
process(Class<?> context,
Object testInstance)
Allows extending the interface to perform action on specific fields on the test class.
|
public Object createMockFor(Annotation annotation, Field field)
createMockFor in interface AnnotationEngineannotation - Annotationfield - Field detailspublic void process(Class<?> context, Object testInstance)
AnnotationEngineSee the implementation of this method to figure out what is it for.
process in interface AnnotationEnginecontext - Class where to extract field information, check implementation for detailstestInstance - Test instanceMockito, MIT License