Class IndependentAnnotationEngine
- java.lang.Object
-
- org.mockito.internal.configuration.IndependentAnnotationEngine
-
- All Implemented Interfaces:
AnnotationEngine
,AnnotationEngine
public class IndependentAnnotationEngine extends java.lang.Object implements AnnotationEngine, AnnotationEngine
Initializes fields annotated with @Mock
or @Captor
.The
process(Class, Object)
method implementation does not process super classes!- See Also:
MockitoAnnotations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mockito.plugins.AnnotationEngine
AnnotationEngine.NoAction
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,FieldAnnotationProcessor<?>>
annotationProcessorMap
-
Constructor Summary
Constructors Constructor Description IndependentAnnotationEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Object
createMockFor(java.lang.annotation.Annotation annotation, java.lang.reflect.Field field)
private <A extends java.lang.annotation.Annotation>
FieldAnnotationProcessor<A>forAnnotation(A annotation)
java.lang.AutoCloseable
process(java.lang.Class<?> clazz, java.lang.Object testInstance)
Processes the test instance to configure annotated members.private <A extends java.lang.annotation.Annotation>
voidregisterAnnotationProcessor(java.lang.Class<A> annotationClass, FieldAnnotationProcessor<A> fieldAnnotationProcessor)
(package private) void
throwIfAlreadyAssigned(java.lang.reflect.Field field, boolean alreadyAssigned)
-
-
-
Field Detail
-
annotationProcessorMap
private final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,FieldAnnotationProcessor<?>> annotationProcessorMap
-
-
Method Detail
-
createMockFor
private java.lang.Object createMockFor(java.lang.annotation.Annotation annotation, java.lang.reflect.Field field)
-
forAnnotation
private <A extends java.lang.annotation.Annotation> FieldAnnotationProcessor<A> forAnnotation(A annotation)
-
registerAnnotationProcessor
private <A extends java.lang.annotation.Annotation> void registerAnnotationProcessor(java.lang.Class<A> annotationClass, FieldAnnotationProcessor<A> fieldAnnotationProcessor)
-
process
public java.lang.AutoCloseable process(java.lang.Class<?> clazz, java.lang.Object testInstance)
Description copied from interface:AnnotationEngine
Processes the test instance to configure annotated members.- Specified by:
process
in interfaceAnnotationEngine
- Parameters:
clazz
- Class where to extract field information, check implementation for detailstestInstance
- Test instance
-
throwIfAlreadyAssigned
void throwIfAlreadyAssigned(java.lang.reflect.Field field, boolean alreadyAssigned)
-
-