blob: ad4e879622d08efdd4478e0e536cb0a51feaf838 [file] [log] [blame]
/*
* 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
* <p/>
* See {@link org.mockito.MockitoAnnotations}
*/
public class DefaultInjectionEngine {
public void injectMocksOnFields(Set<Field> needingInjection, Set<Object> mocks, Object testClassInstance) {
MockInjection.onFields(needingInjection, testClassInstance)
.withMocks(mocks)
.tryConstructorInjection()
.tryPropertyOrFieldInjection()
.handleSpyAnnotation()
.apply();
}
}