AnnotationEngine annotationEngine = new GlobalConfiguration().getAnnotationEngine();
Class<?> clazz = testClass.getClass();
//below can be removed later, when we get read rid of deprecated stuff
if (annotationEngine.getClass() != new DefaultMockitoConfiguration().getAnnotationEngine().getClass()) {
//this means user has his own annotation engine and we have to respect that.
//we will do annotation processing the old way so that we are backwards compatible
while (clazz != Object.class) {
scanDeprecatedWay(annotationEngine, testClass, clazz);
clazz = clazz.getSuperclass();