Java Code Examples for org.mockito.invocation.Invocation#getMethod()
The following examples show how to use
org.mockito.invocation.Invocation#getMethod() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvocationMatcher.java From astor with GNU General Public License v2.0 | 6 votes |
public boolean hasSameMethod(Invocation candidate) { //not using method.equals() for 1 good reason: //sometimes java generates forwarding methods when generics are in play see JavaGenericsForwardingMethodsTest Method m1 = invocation.getMethod(); Method m2 = candidate.getMethod(); if (m1.getName() != null && m1.getName().equals(m2.getName())) { /* Avoid unnecessary cloning */ Class[] params1 = m1.getParameterTypes(); Class[] params2 = m2.getParameterTypes(); if (params1.length == params2.length) { for (int i = 0; i < params1.length; i++) { if (params1[i] != params2[i]) return false; } return true; } } return false; }
Example 2
Source File: MethodInfo.java From astor with GNU General Public License v2.0 | 4 votes |
public MethodInfo(Invocation theInvocation) { this.method = theInvocation.getMethod(); }