@Test void testWrapExceptionInResultInterceptor() { EventMessage<Object> testEventMessage = asEventMessage("testing").andMetaData(MetaData.with("key", "value")); SomeExceptionHandler annotatedEventListener = new SomeExceptionHandler(); testSubject = new AnnotationEventHandlerAdapter(annotatedEventListener, parameterResolverFactory); try { testSubject.handle(testEventMessage); fail("Expected exception"); } catch (Exception e) { assertEquals(RuntimeException.class, e.getClass()); assertEquals(IllegalArgumentException.class, e.getCause().getClass()); assertEquals("testing", e.getCause().getMessage()); assertEquals("value", e.getMessage()); } }
@Override public Object handle(EventMessage<?> event) throws Exception { Optional<MessageHandlingMember<? super Object>> handler = inspector.getHandlers(listenerType) .filter(h -> h.canHandle(event)) .findFirst(); if (handler.isPresent()) { MessageHandlerInterceptorMemberChain<Object> interceptor = inspector.chainedInterceptor(listenerType); return interceptor.handle(event, annotatedEventListener, handler.get()); } return null; }
AnnotationEventHandlerAdapter implements EventMessageHandler { @Override public Object handle(EventMessage<?> event) throws Exception { Optional<MessageHandlingMember<? super Object>> handler = inspector.getHandlers(listenerType) .filter(h -> h.canHandle(event)) .findFirst(); if (handler.isPresent()) { MessageHandlerInterceptorMemberChain<Object> interceptor = inspector.chainedInterceptor(listenerType); return interceptor.handle(event, annotatedEventListener, handler.get()); } return null; } }
AnnotationEventHandlerAdapter implements EventMessageHandler { @Override public Object handle(EventMessage<?> event) throws Exception { Optional<MessageHandlingMember<? super Object>> handler = inspector.getHandlers(listenerType) .filter(h -> h.canHandle(event)) .findFirst(); if (handler.isPresent()) { MessageHandlerInterceptorMemberChain<Object> interceptor = inspector.chainedInterceptor(listenerType); return interceptor.handle(event, annotatedEventListener, handler.get()); } return null; } AnnotationEventHandlerAdapter(Object annotatedEventListener);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory,
                                         HandlerDefinition handlerDefinition); }
AnnotationEventHandlerAdapter implements EventMessageHandler { @Override public Object handle(EventMessage<?> event) throws Exception { Optional<MessageHandlingMember<? super Object>> handler = inspector.getHandlers(listenerType) .filter(h -> h.canHandle(event)) .findFirst(); if (handler.isPresent()) { MessageHandlerInterceptorMemberChain<Object> interceptor = inspector.chainedInterceptor(listenerType); return interceptor.handle(event, annotatedEventListener, handler.get()); } return null; } AnnotationEventHandlerAdapter(Object annotatedEventListener);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory,
                                         HandlerDefinition handlerDefinition); @Override Object handle(EventMessage<?> event); @Override boolean canHandle(EventMessage<?> event); @Override boolean canHandleType(Class<?> payloadType); @Override Class<?> getTargetType(); @Override void prepareReset(); @Override void prepareReset(R resetContext); @Override boolean supportsReset(); }
AnnotationEventHandlerAdapter implements EventMessageHandler { @Override public Object handle(EventMessage<?> event) throws Exception { Optional<MessageHandlingMember<? super Object>> handler = inspector.getHandlers(listenerType) .filter(h -> h.canHandle(event)) .findFirst(); if (handler.isPresent()) { MessageHandlerInterceptorMemberChain<Object> interceptor = inspector.chainedInterceptor(listenerType); return interceptor.handle(event, annotatedEventListener, handler.get()); } return null; } AnnotationEventHandlerAdapter(Object annotatedEventListener);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory);  AnnotationEventHandlerAdapter(Object annotatedEventListener,
                                         ParameterResolverFactory parameterResolverFactory,
                                         HandlerDefinition handlerDefinition); @Override Object handle(EventMessage<?> event); @Override boolean canHandle(EventMessage<?> event); @Override boolean canHandleType(Class<?> payloadType); @Override Class<?> getTargetType(); @Override void prepareReset(); @Override void prepareReset(R resetContext); @Override boolean supportsReset();  }