private static Method findMethodToInvoke(String methodName, Class<?>[] sig, Class<?> objectType) { /* * if invocationControl is null or the method is not mocked, invoke * original method or suppress the method code otherwise invoke the * invocation handler. */ Method method; try { method = WhiteboxImpl.getBestMethodCandidate(objectType, methodName, sig, true); } catch (MethodNotFoundException e) { /* * Dirty hack to get around issue 110 * (http://code.google.com/p/powermock/issues/detail?id=110). Review * this! What we do here is to try to find a reflective method on * class. This has begun to fail since version 1.2 when we supported * mocking static methods in system classes. */ try { method = WhiteboxImpl.getMethod(Class.class, methodName, sig); } catch (MethodNotFoundException e2) { throw e; } } return method; } }
} else { return getBestMethodCandidate(getType(tested), method.getName(), getTypes(arguments), false);
} else if (potentialMethodToInvoke.getName().equals(method.getName())) { return getBestMethodCandidate(getType(tested), method.getName(), getTypes(arguments), false); } else {