};
public boolean processInjection(Field field, Object fieldOwner, Set<Object> mockCandidates) {
// Set<Object> mocksToBeInjected = new HashSet<Object>(mockCandidates);
FieldInitializationReport report = null;
try {
report = new FieldInitializer(fieldOwner, field).initialize();
} catch (MockitoException e) {
if(e.getCause() instanceof InvocationTargetException) {
Throwable realCause = e.getCause().getCause();
new Reporter().fieldInitialisationThrewException(field, realCause);
}
new Reporter().cannotInitializeForInjectMocksAnnotation(field.getName(), e);
}
// for each field in the class hierarchy
boolean injectionOccurred = false;
Class<?> fieldClass = report.fieldClass();
Object fieldInstanceNeedingInjection = report.fieldInstance();
while (fieldClass != Object.class) {
injectionOccurred |= injectMockCandidate(fieldClass, new HashSet<Object>(mockCandidates), fieldInstanceNeedingInjection);
fieldClass = fieldClass.getSuperclass();
}
return injectionOccurred;