SagaMessageStream implements MessageStream { @Override public void close() { if (executor instanceof ExecutorService) { shutDownExecutor((ExecutorService) executor); } AutoCloseables.closeQuietly(environment); AutoCloseables.closeQuietly(invoker); } @Inject  SagaMessageStream(
            final HandlerInvoker invoker,
            final SagaEnvironment environment,
            final Executor executor); @Override void add(@Nonnull final Object message); @Override void add(@Nonnull final Object message, @Nullable final Map<String, Object> headers); @Override void addMessage(@Nonnull final Object message, @Nullable final Map<HeaderName<?>, Object> headers); @Override void handle(@Nonnull final Object message); @Override void handle(@Nonnull final Object message, @Nullable final ExecutionContext parentContext); @Override void handle(@Nonnull final Object message, @Nullable final Map<String, Object> headers); @Override void handleMessage(@Nonnull final Object message, @Nullable final Map<HeaderName<?>, Object> headers); @Override void handle(@Nonnull final Object message, @Nullable final Map<String, Object> headers, @Nullable final ExecutionContext parentContext); @Override void handleMessage(
            @Nonnull final Object message,
            @Nullable final Map<HeaderName<?>, Object> headers,
            @Nullable final ExecutionContext parentContext); @Override void close();  }
@Test public void close_always_executorShutdown() { sut.close(); verify(executorService).shutdown(); }