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.internal.configuration;
 
 
Initializes fields annotated with @Mock

See org.mockito.MockitoAnnotations

public class DefaultAnnotationEngine implements AnnotationEngine {
    
    /* (non-Javadoc)
     * @see org.mockito.AnnotationEngine#createMockFor(java.lang.annotation.Annotation, java.lang.reflect.Field)
     */
    @SuppressWarnings("deprecation")
    public Object createMockFor(Annotation annotationField field) {
        if (annotation instanceof Mock || annotation instanceof org.mockito.MockitoAnnotations.Mock) {
            return Mockito.mock(field.getType(), field.getName());
        } else {
            return null;
        }
    }
New to GrepCode? Check out our FAQ X