public static void initMocks(Object testClass) {
if (testClass == null) {
throw new MockitoException("testClass cannot be null. For info how to use @Mock annotations see examples in javadoc for MockitoAnnotations class");
}
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();
}
}
//anyway act 'the new' way
annotationEngine.process(testClass.getClass(), testClass);
}