Class IndependentAnnotationEngine

java.lang.Object
org.mockito.internal.configuration.IndependentAnnotationEngine
All Implemented Interfaces:
AnnotationEngine, AnnotationEngine

public class IndependentAnnotationEngine extends Object implements AnnotationEngine, AnnotationEngine
Initializes fields annotated with @Mock or @Captor.

The process(Class, Object) method implementation does not process super classes!

See Also:
  • Field Details

  • Constructor Details

    • IndependentAnnotationEngine

      public IndependentAnnotationEngine()
  • Method Details

    • createMockFor

      private Object createMockFor(Annotation annotation, Field field)
    • forAnnotation

      private <A extends Annotation> FieldAnnotationProcessor<A> forAnnotation(A annotation)
    • registerAnnotationProcessor

      private <A extends Annotation> void registerAnnotationProcessor(Class<A> annotationClass, FieldAnnotationProcessor<A> fieldAnnotationProcessor)
    • process

      public AutoCloseable process(Class<?> clazz, Object testInstance)
      Description copied from interface: AnnotationEngine
      Processes the test instance to configure annotated members.
      Specified by:
      process in interface AnnotationEngine
      Parameters:
      clazz - Class where to extract field information, check implementation for details
      testInstance - Test instance
    • throwIfAlreadyAssigned

      void throwIfAlreadyAssigned(Field field, boolean alreadyAssigned)