@SuperCall Callable<?> proxy, @SuperMethod(nullIfImpossible = true) Method method, @StubValue Object stub) throws Exception { try { Object result = proxy.call();
@SuppressWarnings("unused") @RuntimeType public static Object interceptAbstract(@This Object mock, @FieldValue("mockitoInterceptor") MockMethodInterceptor interceptor, @StubValue Object stubValue, @Origin Method invokedMethod, @AllArguments Object[] arguments) throws Throwable { if (interceptor == null) { return stubValue; } return interceptor.doIntercept( mock, invokedMethod, arguments, RealMethod.IsIllegal.INSTANCE ); } }
@Origin final Method method, @AllArguments final Object[] arguments, @StubValue final Object stubValue, @FieldValue(INTERCEPTOR_FIELD_NAME) Interceptor interceptor ) throws Throwable {
@SuperCall Callable<?> proxy, @SuperMethod(nullIfImpossible = true) Method method, @StubValue Object stub) throws Exception { try { Object result = proxy.call();
@RuntimeType public static Object interceptAbstract(@FieldValue("$spock_interceptor") IProxyBasedMockInterceptor proxyBasedMockInterceptor, @This Object self, @AllArguments Object[] arguments, @Origin Method method, @StubValue Object stubValue) throws Exception { Object returnValue; if (proxyBasedMockInterceptor == null) { returnValue = null; // Call before interceptor was set (constructor). } else { returnValue = proxyBasedMockInterceptor.intercept(self, method, arguments, new ByteBuddyMethodInvoker(null)); } return returnValue == null ? stubValue : returnValue; }
@RuntimeType public static Object interceptNonAbstract(@FieldValue("$spock_interceptor") IProxyBasedMockInterceptor proxyBasedMockInterceptor, @Morph ByteBuddyInvoker invoker, @This Object self, @AllArguments Object[] arguments, @Origin Method method, @StubValue Object stubValue) throws Exception { Object returnValue; if (proxyBasedMockInterceptor == null) { returnValue = invoker.call(arguments); // Call before interceptor was set (constructor). } else { returnValue = proxyBasedMockInterceptor.intercept(self, method, arguments, new ByteBuddyMethodInvoker(invoker)); } return returnValue == null ? stubValue : returnValue; }
@Origin final Method method, @AllArguments final Object[] arguments, @StubValue final Object stubValue, @FieldValue(INTERCEPTOR_FIELD_NAME) Interceptor interceptor ) throws Throwable {