• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.internal.configuration;
6 
7 import java.lang.reflect.Field;
8 import java.util.Set;
9 
10 import org.mockito.internal.configuration.injection.MockInjection;
11 
12 /**
13  * Inject mock/spies dependencies for fields annotated with @InjectMocks
14  * <p/>
15  * See {@link org.mockito.MockitoAnnotations}
16  */
17 public class DefaultInjectionEngine {
18 
injectMocksOnFields(Set<Field> needingInjection, Set<Object> mocks, Object testClassInstance)19     public void injectMocksOnFields(Set<Field> needingInjection, Set<Object> mocks, Object testClassInstance) {
20         MockInjection.onFields(needingInjection, testClassInstance)
21                 .withMocks(mocks)
22                 .tryConstructorInjection()
23                 .tryPropertyOrFieldInjection()
24                 .handleSpyAnnotation()
25                 .apply();
26     }
27 
28 }
29