use of io.quarkus.test.junit.mockito.InjectSpy in project quarkus by quarkusio.
the class CreateMockitoSpiesCallback method afterConstruct.
@Override
public void afterConstruct(Object testInstance) {
Class<?> current = testInstance.getClass();
while (current.getSuperclass() != null) {
for (Field field : current.getDeclaredFields()) {
InjectSpy injectSpyAnnotation = field.getAnnotation(InjectSpy.class);
if (injectSpyAnnotation != null) {
Object beanInstance = CreateMockitoMocksCallback.getBeanInstance(testInstance, field, InjectSpy.class);
Object spy = createSpyAndSetTestField(testInstance, field, beanInstance);
MockitoMocksTracker.track(testInstance, spy, beanInstance);
}
}
current = current.getSuperclass();
}
}