@SuppressWarnings("unchecked") @Test public void invokeOnSubscribeRxJava() throws Throwable { given(this.methodHandler.invoke(any())).willReturn("Result"); RxJavaInvocationHandler handler = new RxJavaInvocationHandler(this.target, Collections.singletonMap(this.method, this.methodHandler), io.reactivex.schedulers.Schedulers.trampoline()); Object result = handler.invoke(this.method, this.methodHandler, new Object[] {}); assertThat(result).isInstanceOf(Flowable.class); verifyZeroInteractions(this.methodHandler); StepVerifier.create((Flowable) result) .expectNext("Result") .expectComplete() .verify(); verify(this.methodHandler, times(1)).invoke(any()); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return this.invoke(method, this.dispatch.get(method), args); }
ReactiveInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return this.invoke(method, this.dispatch.get(method), args); } }
ReactiveInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return this.invoke(method, this.dispatch.get(method), args); } ReactiveInvocationHandler(Target<?> target,
      Map<Method, MethodHandler> dispatch); }
ReactiveInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return this.invoke(method, this.dispatch.get(method), args); } ReactiveInvocationHandler(Target<?> target,
      Map<Method, MethodHandler> dispatch); @Override Object invoke(Object proxy, Method method, Object[] args); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
ReactiveInvocationHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("equals".equals(method.getName())) { try { Object otherHandler = args.length > 0 && args[0] != null ? Proxy.getInvocationHandler(args[0]) : null; return equals(otherHandler); } catch (IllegalArgumentException e) { return false; } } else if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("toString".equals(method.getName())) { return toString(); } return this.invoke(method, this.dispatch.get(method), args); } ReactiveInvocationHandler(Target<?> target,
      Map<Method, MethodHandler> dispatch); @Override Object invoke(Object proxy, Method method, Object[] args); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }