@Test
public void findSagaInstanceKey_sagaCalledWithContext_contextUsedAsReaderParameter() {

    // given
    LookupContext originalContext = SagaLookupContext.forMessage("my input event message");
    final LookupContext[] providedReaderContext = new LookupContext[1];
    KeyReader reader = KeyReaders.forMessage(String.class, new ContextKeyExtractFunction<String, String>() {
            @Nullable
            @Override
            public String key(final String message, final LookupContext context) {
                providedReaderContext[0] = context;
                return null;
            }
        });
    when(testSaga.keyReaders()).thenReturn(Lists.newArrayList(reader));
    // when
    sut.findSagaInstanceKey(Saga.class, originalContext);
    // then
    assertThat("Expected context in key reader to be the same as the original.", providedReaderContext[0], sameInstance(originalContext));
}