SagaExecutionTask implements ExecutedRunnable { @Override public <T> Optional<T> getHeaderValue(final HeaderName<T> header) { return taskLookupContext.getHeaderValue(header); } @Inject  SagaExecutionTask(
            final SagaEnvironment environment,
            final HandlerInvoker invoker,
            final Object message,
            final Map<HeaderName<?>, Object> headers,
            @Nullable final ExecutionContext parentContext); void handle(); @Override void run(); @Override Object message(); @Override Optional<T> getHeaderValue(final HeaderName<T> header);  }
@Test public void getHeaderValue_headerValueSet_returnValue() { HeaderName<Integer> contextHeader = HeaderName.forType(Integer.class, "contextId"); Map<HeaderName<?>, Object> headers = ImmutableMap.of(contextHeader, 42); SagaExecutionTask task = new SagaExecutionTask(null, invoker, theMessage, headers, null); Optional<Integer> headerValue = task.getHeaderValue(contextHeader); assertThat("Expected provided header value to be available.", headerValue.get(), equalTo(42)); }