### Question:
CachingInvocationHandler implements InvocationHandler { protected static Method findMethod(Class<?> objectClass, String methodName, Class<?>[] parameterTypes) { Method[] methods = objectClass.getDeclaredMethods(); for (Method method : methods) { if (! method.getName().equals(methodName)) continue; if (matchParameterTypes(method.getParameterTypes(), parameterTypes)) return method; } throw new IllegalArgumentException("Unable to find a method '" + methodName + "' in object " + objectClass.getName() + " accepting parameter types " + Arrays.toString(parameterTypes)); } CachingInvocationHandler(Object interfaceClass, Object delegate); @Override Object invoke(Object proxy, Method method, Object[] args);  }### Answer:
@Test public void findMethod_returns_it() { assertNotNull(CachingInvocationHandler.findMethod(CachingObjectFactoryTest.MyImplementation.class, "value", null)); assertNotNull(CachingInvocationHandler.findMethod(CachingObjectFactoryTest.MyImplementation.class, "parametrized", new Class<?>[]{ Integer.class, String.class, CachingObjectFactoryTest.ComplexParam.class })); }