use of org.mockito.InjectMocks in project mockito by mockito.
the class InjectMocksScanner method scan.
/**
* Scan fields annotated by @InjectMocks
*
* @return Fields that depends on Mock
*/
@SuppressWarnings("unchecked")
private Set<Field> scan() {
Set<Field> mockDependentFields = new HashSet<Field>();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (null != field.getAnnotation(InjectMocks.class)) {
assertNoAnnotations(field, Mock.class, Captor.class);
mockDependentFields.add(field);
}
}
return mockDependentFields;
}
Aggregations