All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.internal.configuration.DefaultInjectionEngine Maven / Gradle / Ivy

There is a newer version: 2.0.2-beta
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.configuration;

import org.mockito.internal.configuration.injection.MockInjection;

import java.lang.reflect.Field;
import java.util.Set;

/**
 * Inject mock/spies dependencies for fields annotated with @InjectMocks
 * 

* See {@link org.mockito.MockitoAnnotations} */ public class DefaultInjectionEngine { public void injectMocksOnFields(Set needingInjection, Set mocks, Object testClassInstance) { MockInjection.onFields(needingInjection, testClassInstance) .withMocks(mocks) .tryConstructorInjection() .tryPropertyOrFieldInjection() .handleSpyAnnotation() .apply(); } }