@Test @SuppressWarnings("unchecked") void testChainWithDifferentProceedCalls() throws Exception { MessageHandlerInterceptor interceptor1 = (unitOfWork, interceptorChain) -> { unitOfWork.transformMessage(m -> new GenericMessage<>("testing")); return interceptorChain.proceed(); }; MessageHandlerInterceptor interceptor2 = (unitOfWork, interceptorChain) -> interceptorChain.proceed(); unitOfWork.transformMessage(m -> new GenericMessage<>("original")); DefaultInterceptorChain testSubject = new DefaultInterceptorChain( unitOfWork, asList(interceptor1, interceptor2), mockHandler ); String actual = (String) testSubject.proceed(); assertSame("Result", actual); verify(mockHandler).handle(argThat(x -> (x != null) && x.getPayload().equals("testing"))); }
@Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } }
DefaultInterceptorChain implements InterceptorChain { @Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } }
DefaultInterceptorChain implements InterceptorChain { @Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } DefaultInterceptorChain(UnitOfWork<? extends T> unitOfWork,
                                   Iterable<? extends MessageHandlerInterceptor<? super T>> interceptors,
                                   MessageHandler<? super T> handler); }
DefaultInterceptorChain implements InterceptorChain { @Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } DefaultInterceptorChain(UnitOfWork<? extends T> unitOfWork,
                                   Iterable<? extends MessageHandlerInterceptor<? super T>> interceptors,
                                   MessageHandler<? super T> handler); @Override Object proceed(); }
DefaultInterceptorChain implements InterceptorChain { @Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } DefaultInterceptorChain(UnitOfWork<? extends T> unitOfWork,
                                   Iterable<? extends MessageHandlerInterceptor<? super T>> interceptors,
                                   MessageHandler<? super T> handler); @Override Object proceed();  }