try {
f.setAccessible(true);
final Object mockInstance = f.get(instance.getInstance());
if (Mock.class.equals(annotation.annotationType())) {
final Mock mock = (Mock) annotation;
if (!"".equals(mock.name())) {
mockInstancesByName.put(mock.name(), mockInstance);
} else {
mockInstancesByType.put(f.getType(), mockInstance);
}
} else {
mockInstancesByType.put(f.getType(), mockInstance);