@SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test void testHandlerInterceptorWithFailedExecution() throws Exception { RuntimeException exception = new RuntimeException(); when(interceptorChain.proceed()).thenThrow(exception); when(mockLogger.isInfoEnabled()).thenReturn(true); try { testSubject.handle(unitOfWork, interceptorChain); fail("Expected exception to be propagated"); } catch (RuntimeException e) { } verify(mockLogger).logIfEnabled(anyString(), eq(Level.INFO), isNull(), anyString(), contains("StubMessage")); verify(mockLogger).logIfEnabled( anyString(), eq(Level.WARN), isNull(), and(contains("failed"), contains("StubMessage")), eq(exception) ); verifyNoMoreInteractions(mockLogger); }
@Override public BiFunction<Integer, T, T> handle(List<? extends T> messages) { return (i, message) -> { logger.info("Dispatched messages: [{}]", message.getPayloadType().getSimpleName()); return message; }; }
LoggingInterceptor implements MessageDispatchInterceptor<T>, MessageHandlerInterceptor<T> { @Override public BiFunction<Integer, T, T> handle(List<? extends T> messages) { return (i, message) -> { logger.info("Dispatched messages: [{}]", message.getPayloadType().getSimpleName()); return message; }; } }
LoggingInterceptor implements MessageDispatchInterceptor<T>, MessageHandlerInterceptor<T> { @Override public BiFunction<Integer, T, T> handle(List<? extends T> messages) { return (i, message) -> { logger.info("Dispatched messages: [{}]", message.getPayloadType().getSimpleName()); return message; }; } LoggingInterceptor(String loggerName);  LoggingInterceptor(); }
LoggingInterceptor implements MessageDispatchInterceptor<T>, MessageHandlerInterceptor<T> { @Override public BiFunction<Integer, T, T> handle(List<? extends T> messages) { return (i, message) -> { logger.info("Dispatched messages: [{}]", message.getPayloadType().getSimpleName()); return message; }; } LoggingInterceptor(String loggerName);  LoggingInterceptor(); @Override BiFunction<Integer, T, T> handle(List<? extends T> messages); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain); }
LoggingInterceptor implements MessageDispatchInterceptor<T>, MessageHandlerInterceptor<T> { @Override public BiFunction<Integer, T, T> handle(List<? extends T> messages) { return (i, message) -> { logger.info("Dispatched messages: [{}]", message.getPayloadType().getSimpleName()); return message; }; } LoggingInterceptor(String loggerName);  LoggingInterceptor(); @Override BiFunction<Integer, T, T> handle(List<? extends T> messages); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain);  }