Method[] methods = Whitebox.getMethods(declaringClass, methodName);
if (methods.length == 0) {
throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName,
declaringClass.getName()));
} else if (methods.length > 1) {
throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length,
methodName, declaringClass.getName()));
}
MockRepository.putMethodProxy(methods[0], invocationHandler);
}