@Test public void shouldThrowIllegalArgumentExceptionWithNotRxJava2Type() throws Throwable{ TimeLimiter timeLimiter = TimeLimiter.ofDefaults("test"); when(proceedingJoinPoint.proceed()).thenReturn("NOT RXJAVA2 TYPE"); try { rxJava2TimeLimiterAspectExt.handle(proceedingJoinPoint, timeLimiter, "testMethod"); fail("exception missed"); } catch (Throwable e) { assertThat(e).isInstanceOf(IllegalReturnTypeException.class) .hasMessage( "java.lang.String testMethod has unsupported by @TimeLimiter return type. RxJava2 expects Flowable/Single/..."); } }
@Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { TimeLimiterTransformer<?> timeLimiterTransformer = TimeLimiterTransformer.of(timeLimiter); Object returnValue = proceedingJoinPoint.proceed(); return executeRxJava2Aspect(timeLimiterTransformer, returnValue, methodName); }
RxJava2TimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { TimeLimiterTransformer<?> timeLimiterTransformer = TimeLimiterTransformer.of(timeLimiter); Object returnValue = proceedingJoinPoint.proceed(); return executeRxJava2Aspect(timeLimiterTransformer, returnValue, methodName); } }
RxJava2TimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { TimeLimiterTransformer<?> timeLimiterTransformer = TimeLimiterTransformer.of(timeLimiter); Object returnValue = proceedingJoinPoint.proceed(); return executeRxJava2Aspect(timeLimiterTransformer, returnValue, methodName); }  }
RxJava2TimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { TimeLimiterTransformer<?> timeLimiterTransformer = TimeLimiterTransformer.of(timeLimiter); Object returnValue = proceedingJoinPoint.proceed(); return executeRxJava2Aspect(timeLimiterTransformer, returnValue, methodName); }  @Override boolean canHandleReturnType(Class<?> returnType); @Override Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName); }
RxJava2TimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { TimeLimiterTransformer<?> timeLimiterTransformer = TimeLimiterTransformer.of(timeLimiter); Object returnValue = proceedingJoinPoint.proceed(); return executeRxJava2Aspect(timeLimiterTransformer, returnValue, methodName); }  @Override boolean canHandleReturnType(Class<?> returnType); @Override Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName);  }