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.plugins; 6 7 /** 8 * Configures test via annotations. 9 * 10 * <p>Mockito default engine handles the logic behind @Mock, @Captor, @Spy and @InjectMocks annotations. 11 * 12 * <p>This interface is an extension point that make possible to use a different annotation engine allowing to extend 13 * or replace mockito default engine. 14 * 15 * <p> 16 * If you are interested then see implementations or source code of {@link org.mockito.MockitoAnnotations#openMocks(Object)} 17 * 18 * <p>This plugin mechanism supersedes the {@link org.mockito.configuration.IMockitoConfiguration} 19 * in regard of switching mockito components. 20 */ 21 public interface AnnotationEngine { 22 /** 23 * Processes the test instance to configure annotated members. 24 * 25 * @param clazz Class where to extract field information, check implementation for details 26 * @param testInstance Test instance 27 */ process(Class<?> clazz, Object testInstance)28 AutoCloseable process(Class<?> clazz, Object testInstance); 29 30 class NoAction implements AutoCloseable { 31 32 @Override close()33 public void close() {} 34 } 35 } 36