blob: e5e98a1a20a7bdec765782c4e568be1d29fe25f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.configuration;
import java.lang.reflect.Field;
import java.util.Set;
import org.mockito.internal.configuration.injection.MockInjection;
/**
* 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();
}
}
|