Class InjectingAnnotationEngine

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

public class InjectingAnnotationEngine extends Object implements AnnotationEngine
  • Constructor Details

    • InjectingAnnotationEngine

      public InjectingAnnotationEngine()
  • Method Details

    • process

      public AutoCloseable process(Class<?> clazz, Object testInstance)
      Process the fields of the test instance and create Mocks, Spies, Captors and inject them on fields annotated @InjectMocks.

      This code process the test class and the super classes.

      1. First create Mocks, Spies, Captors.
      2. Then try to inject them.
      Specified by:
      process in interface AnnotationEngine
      Parameters:
      clazz - Not used
      testInstance - The instance of the test, should not be null.
      See Also:
    • injectMocks

      @Deprecated public void injectMocks(Object testClassInstance)
      Deprecated.
      Use injectCloseableMocks(Object).
      Required by PowerMockito and retained to avoid API breakage despite being internal API.
    • onInjection

      protected void onInjection(Object testClassInstance, Class<?> clazz, Set<Field> mockDependentFields, Set<Object> mocks)