@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { Class<?>[] cls = new Class[args.length]; for (int i = 0; i < args.length; i++) { cls[i] = args[i].getClass(); } return ClassUtils.searchForMethod(RMap.class, method.getName(), cls).invoke(map, args); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { Class<?>[] cls = new Class[args.length]; for (int i = 0; i < args.length; i++) { cls[i] = args[i].getClass(); } return ClassUtils.searchForMethod(RExpirable.class, method.getName(), cls).invoke(map, args); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions"); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @This Object me, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) { String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1); if ("get".equals(method.getName()) && args.length == 1) { try { return me.getClass().getMethod("get" + name).invoke(me); } catch (NoSuchMethodException noSuchMethodException) { throw new NoSuchFieldException((String) args[0]); } } else if ("set".equals(method.getName()) && args.length == 2) { Method m = ClassUtils.searchForMethod(me.getClass(), "set" + name, new Class[]{args[1].getClass()}); if (m != null) { return m.invoke(me, args[1]); } else { throw new NoSuchFieldException((String) args[0]); } } } throw new NoSuchMethodException(method.getName() + " has wrong signature"); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { Class<?>[] cls = new Class[args.length]; for (int i = 0; i < args.length; i++) { cls[i] = args[i].getClass(); } return ClassUtils.searchForMethod(RMap.class, method.getName(), cls).invoke(map, args); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @This Object me, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) { String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1); if ("get".equals(method.getName()) && args.length == 1) { try { return me.getClass().getMethod("get" + name).invoke(me); } catch (NoSuchMethodException noSuchMethodException) { throw new NoSuchFieldException((String) args[0]); } } else if ("set".equals(method.getName()) && args.length == 2) { Method m = ClassUtils.searchForMethod(me.getClass(), "set" + name, new Class[]{args[1].getClass()}); if (m != null) { return m.invoke(me, args[1]); } else { throw new NoSuchFieldException((String) args[0]); } } } throw new NoSuchMethodException(method.getName() + " has wrong signature"); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { Class<?>[] cls = new Class[args.length]; for (int i = 0; i < args.length; i++) { cls[i] = args[i].getClass(); } return ClassUtils.searchForMethod(RExpirable.class, method.getName(), cls).invoke(map, args); } }
@RuntimeType public static Object intercept( @Origin Method method, @AllArguments Object[] args, @FieldValue("liveObjectLiveMap") RMap<?, ?> map ) throws Exception { throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions"); } }
@RuntimeType public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher, @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod, @This AbstractAssert<?, ?> currentAssertInstance) throws Exception { Object result = assertionMethod.call(); return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance); }
@RuntimeType public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher, @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod, @This AbstractAssert<?, ?> currentAssertInstance) throws Exception { Object result = assertionMethod.call(); return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance); }
public static Object intercept(@FieldValue(FIELD_NAME) ErrorCollector errorCollector, @This Object assertion, @SuperCall Callable<?> proxy,
@SuppressWarnings("unused") @RuntimeType @BindingPriority(BindingPriority.DEFAULT * 2) public static Object interceptSuperCallable(@This Object mock, @FieldValue("mockitoInterceptor") MockMethodInterceptor interceptor, @Origin Method invokedMethod, @AllArguments Object[] arguments, @SuperCall(serializableProxy = true) Callable<?> superCall) throws Throwable { if (interceptor == null) { return superCall.call(); } return interceptor.doIntercept( mock, invokedMethod, arguments, new RealMethod.FromCallable(superCall) ); }
@AllArguments Object[] args, @This Object me, @FieldValue("liveObjectId") Object id, @FieldProxy("liveObjectId") Setter idSetter, @FieldProxy("liveObjectId") Getter idGetter, @FieldValue("liveObjectLiveMap") RMap<?, ?> map, @FieldProxy("liveObjectLiveMap") Setter mapSetter, @FieldProxy("liveObjectLiveMap") Getter mapGetter
@AllArguments final Object[] arguments, @StubValue final Object stubValue, @FieldValue(INTERCEPTOR_FIELD_NAME) Interceptor interceptor ) throws Throwable { if ( interceptor == null ) {
@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 ); } }
@AllArguments Object[] args, @This Object me, @FieldValue("liveObjectId") Object id, @FieldProxy("liveObjectId") Setter idSetter, @FieldProxy("liveObjectId") Getter idGetter, @FieldValue("liveObjectLiveMap") RMap<?, ?> map, @FieldProxy("liveObjectLiveMap") Setter mapSetter, @FieldProxy("liveObjectLiveMap") Getter mapGetter
@RuntimeType public Object intercept(@Origin Method method, @SuperCall Callable<?> superMethod, @AllArguments Object[] args, @This Object me, @FieldValue("liveObjectLiveMap") RMap<String, Object> liveMap) throws Exception { if (isGetter(method, getREntityIdFieldName(me))) { return ((RLiveObject) me).getLiveObjectId();
@RuntimeType public Object intercept(@Origin Method method, @SuperCall Callable<?> superMethod, @AllArguments Object[] args, @This Object me, @FieldValue("liveObjectLiveMap") RMap<String, Object> liveMap) throws Exception { if (isGetter(method, getREntityIdFieldName(me))) { return ((RLiveObject) me).getLiveObjectId();
@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; }