return proxyFactory.createMock(classToMock, filter);
}
public static <T> MockHandler<T> getMockHandler(T mock) {
if (mock == null) {
throw new NotAMockException("Argument should be a mock, but is null!");
}
try {
if (Enhancer.isEnhanced(mock.getClass())) {
return ((MethodInterceptorFilter<MockHandler<T>>) getInterceptor(mock)).getDelegate();
} else {
throw new NotAMockException("Argument should be a mock, but is: " + mock.getClass());
}
} catch (ClassCastException e) {
throw new NotAMockException("Argument should be a mock, but is: " + mock.getClass());
}
}