Home | History | Annotate | Download | only in configuration
      1 /*
      2  * Copyright (c) 2007 Mockito contributors
      3  * This program is made available under the terms of the MIT License.
      4  */
      5 package org.mockito.configuration;
      6 
      7 import org.mockito.MockitoAnnotations;
      8 
      9 import java.lang.annotation.Annotation;
     10 import java.lang.reflect.Field;
     11 
     12 /**
     13  * Configures mock creation logic behind @Mock, @Captor and @Spy annotations
     14  * <p>
     15  * If you are interested then see implementations or source code of {@link MockitoAnnotations#initMocks(Object)}
     16  */
     17 public interface AnnotationEngine {
     18 
     19     /**
     20      * @deprecated
     21      * Please use {@link AnnotationEngine#process(Class, Object)} method instead that is more robust
     22      * <p>
     23      * Creates mock, ArgumentCaptor or wraps field instance in spy object.
     24      * Only if of correct annotation type.
     25      *
     26      * @param annotation Annotation
     27      * @param field Field details
     28      */
     29     @Deprecated
     30     Object createMockFor(Annotation annotation, Field field);
     31 
     32     /**
     33      * Allows extending the interface to perform action on specific fields on the test class.
     34      * <p>
     35      * See the implementation of this method to figure out what is it for.
     36      *
     37      * @param clazz Class where to extract field information, check implementation for details
     38      * @param testInstance Test instance
     39      */
     40     void process(Class<?> clazz, Object testInstance);
     41 }