InjectingAnnotationEngine
Date: 2015-09-18

org.mockito.internal.configuration

## Class InjectingAnnotationEngine

- java.lang.Object
- - org.mockito.internal.configuration.InjectingAnnotationEngine

- All Implemented Interfaces:
    AnnotationEngine

      public class InjectingAnnotationEngine
      extends java.lang.Object
      implements AnnotationEngine

  See `MockitoAnnotations`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InjectingAnnotationEngine()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `createMockFor(java.lang.annotation.Annotation annotation, java.lang.reflect.Field field)` Deprecated.
    `void` | `injectMocks(java.lang.Object testClassInstance)` Initializes mock/spies dependencies for objects annotated with @InjectMocks for given testClassInstance.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InjectingAnnotationEngine

          public InjectingAnnotationEngine()

  - ### Method Detail

    - #### createMockFor

          @Deprecated
          public java.lang.Object createMockFor(java.lang.annotation.Annotation annotation,
                                                  java.lang.reflect.Field field)

      Deprecated.
      Create a mock using `DefaultAnnotationEngine`
      Specified by:
        `createMockFor` in interface `AnnotationEngine`
      Parameters:
        `annotation` - Annotation
        `field` - Field details
      See Also:
        `DefaultAnnotationEngine`, `AnnotationEngine.createMockFor(java.lang.annotation.Annotation, java.lang.reflect.Field)`

    - #### process

          public 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.

      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:
        `AnnotationEngine.process(Class, Object)`

    - #### injectMocks

          public void injectMocks(java.lang.Object testClassInstance)

      Initializes mock/spies dependencies for objects annotated with @InjectMocks for given testClassInstance.

      See examples in javadoc for `MockitoAnnotations` class.

      Parameters:
        `testClassInstance` - Test class, usually `this`