Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2007 Mockito contributors
  * This program is made available under the terms of the MIT License.
  */
 package org.mockito.configuration;
 
 
Configures mock creation logic behind @Mock annotations

If you are interested then see implementations or source code of org.mockito.MockitoAnnotations.initMocks(java.lang.Object)

public interface AnnotationEngine {

    
Usually the implementation checks the annotation and then creates a mock object for specified field.

You don't need to set the mock on the field. Mockito does it for you. If in doubts look for implementations of this interface.

For annotations that you don't care about just return null - then Mockito will not initialize this field

Parameters:
annotation annotation on the field, for example @Mock
field field to create mock object for
Returns:
mock created for specified field. Can be null - then Mockito will not initialize the field
    Object createMockFor(Annotation annotationField field);
New to GrepCode? Check out our FAQ X