public boolean isToString(Method method) { return isToString(new DelegatingMethod(method)); }
private static MockitoMethod createMockitoMethod(Method method, MockCreationSettings settings) { if (settings.isSerializable()) { return new SerializableMethod(method); } else { return new DelegatingMethod(method); } } }
public static boolean isToStringMethod(Method method) { MockitoMethod m = new DelegatingMethod(method); return m.getReturnType() == String.class && m.getParameterTypes().length == 0 && "toString".equals(m.getName()); }
public MockitoMethod createMockitoMethod(Method method) { if (mockSettings.isSerializable()) { return new SerializableMethod(method); } else { return new DelegatingMethod(method); } } }
public MockitoMethod createMockitoMethod(Method method) { if (mockSettings.isSerializable()) { return new SerializableMethod(method); } else { return new DelegatingMethod(method); } } }
private Object performIntercept(MethodInterceptorFilter invocationHandler, final Object interceptionObject, final Method method, Object[] arguments) throws Throwable { MockHandler mockHandler = invocationHandler.getHandler(); final CleanTraceRealMethod cglibProxyRealMethod = new CleanTraceRealMethod(new MockedRealMethod(method, interceptionObject)); Invocation invocation = new InvocationImpl( interceptionObject, new DelegatingMethod(method), arguments, SequenceNumber.next(), cglibProxyRealMethod) { private static final long serialVersionUID = -3679957412502758558L; @Override public String toString() { return new ToStringGenerator().generate(getMock(), getMethod(), getArguments()); } }; try { return replaceMatchersBinderIfNeeded(mockHandler).handle(invocation); } catch (NotAMockException e) { if(invocation.getMock().getClass().getName().startsWith("java.") && MockRepository.getInstanceMethodInvocationControl(invocation.getMock()) != null) { return invocation.callRealMethod(); } else { throw e; } } catch (MockitoAssertionError e) { InvocationControlAssertionError.updateErrorMessageForMethodInvocation(e); throw e; } }
public boolean isToString(Method method) { return isToString(new DelegatingMethod(method)); }
public MockitoMethod createMockitoMethod(Method method) { if (mockSettings.isSerializable()) { return new SerializableMethod(method); } else { return new DelegatingMethod(method); } } }