test_class.declarator: sut
test_class.modifier: private
test_class.original_string: private SagaKeyReaderExtractor sut;
test_class.type: SagaKeyReaderExtractor
test_class.var_name: sut
test_class.declarator: testSaga
test_class.modifier: private
test_class.original_string: private Saga testSaga;
test_class.type: Saga
test_class.var_name: testSaga
test_class.file: saga-lib/src/test/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractorTest.java
test_class.identifier: SagaKeyReaderExtractorTest
test_case.body: @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));
      }
test_case.class_method_signature: SagaKeyReaderExtractorTest.findSagaInstanceKey_sagaCalledWithContext_contextUsedAsReaderParameter()
test_case.full_signature: @Test public void findSagaInstanceKey_sagaCalledWithContext_contextUsedAsReaderParameter()
test_case.identifier: findSagaInstanceKey_sagaCalledWithContext_contextUsedAsReaderParameter
test_case.invocations: forMessage forMessage thenReturn when keyReaders newArrayList findSagaInstanceKey assertThat sameInstance
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void findSagaInstanceKey_sagaCalledWithContext_contextUsedAsReaderParameter()
focal_class.declarator: LOG = LoggerFactory.getLogger(SagaKeyReaderExtractor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(SagaKeyReaderExtractor.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: sagaProviderFactory
focal_class.modifier: private final
focal_class.original_string: private final SagaProviderFactory sagaProviderFactory;
focal_class.type: SagaProviderFactory
focal_class.var_name: sagaProviderFactory
focal_class.declarator: knownReaders
focal_class.modifier: private final
focal_class.original_string: private final Cache<SagaMessageKey, Optional<KeyReader>> knownReaders;
focal_class.type: Cache<SagaMessageKey, Optional<KeyReader>>
focal_class.var_name: knownReaders
focal_class.file: saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaKeyReaderExtractor.java
focal_class.identifier: SagaKeyReaderExtractor
focal_class.interfaces: implements KeyExtractor
focal_class.class_method_signature: SagaKeyReaderExtractor.SagaKeyReaderExtractor(final SagaProviderFactory sagaProviderFactory)
focal_class.full_signature: @Inject public  SagaKeyReaderExtractor(final SagaProviderFactory sagaProviderFactory)
focal_class.identifier: SagaKeyReaderExtractor
focal_class.modifiers: @Inject public
focal_class.parameters: (final SagaProviderFactory sagaProviderFactory)
focal_class.signature:  SagaKeyReaderExtractor(final SagaProviderFactory sagaProviderFactory)
focal_class.class_method_signature: SagaKeyReaderExtractor.findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_class.full_signature: @Override public Object findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_class.identifier: findSagaInstanceKey
focal_class.modifiers: @Override public
focal_class.parameters: (final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_class.return: Object
focal_class.signature: Object findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_class.class_method_signature: SagaKeyReaderExtractor.tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.full_signature: private KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.identifier: tryGetKeyReader
focal_class.modifiers: private
focal_class.parameters: (final Class<? extends Saga> sagaClazz, final Object message)
focal_class.return: KeyReader
focal_class.signature: KeyReader tryGetKeyReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.class_method_signature: SagaKeyReaderExtractor.findReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.full_signature: private KeyReader findReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.identifier: findReader
focal_class.modifiers: private
focal_class.parameters: (final Class<? extends Saga> sagaClazz, final Object message)
focal_class.return: KeyReader
focal_class.signature: KeyReader findReader(final Class<? extends Saga> sagaClazz, final Object message)
focal_class.class_method_signature: SagaKeyReaderExtractor.findReaderMatchingExactType(final Iterable<KeyReader> readers, final Class<?> messageType)
focal_class.full_signature: private KeyReader findReaderMatchingExactType(final Iterable<KeyReader> readers, final Class<?> messageType)
focal_class.identifier: findReaderMatchingExactType
focal_class.modifiers: private
focal_class.parameters: (final Iterable<KeyReader> readers, final Class<?> messageType)
focal_class.return: KeyReader
focal_class.signature: KeyReader findReaderMatchingExactType(final Iterable<KeyReader> readers, final Class<?> messageType)
focal_class.class_method_signature: SagaKeyReaderExtractor.findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz)
focal_class.full_signature: private Collection<KeyReader> findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz)
focal_class.identifier: findReader
focal_class.modifiers: private
focal_class.parameters: (final Class<? extends Saga> sagaClazz, final Class<?> messageClazz)
focal_class.return: Collection<KeyReader>
focal_class.signature: Collection<KeyReader> findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz)
focal_method.body: @Override
      public Object findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context) {
          Object keyValue = null;
  
          KeyReader reader = tryGetKeyReader(sagaClazz, context.message());
          if (reader != null) {
              keyValue = reader.readKey(context.message(), context);
          }
  
          return keyValue;
      }
focal_method.class_method_signature: SagaKeyReaderExtractor.findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_method.full_signature: @Override public Object findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_method.identifier: findSagaInstanceKey
focal_method.invocations: tryGetKeyReader message readKey message
focal_method.modifiers: @Override public
focal_method.parameters: (final Class<? extends Saga> sagaClazz, final LookupContext context)
focal_method.return: Object
focal_method.signature: Object findSagaInstanceKey(final Class<? extends Saga> sagaClazz, final LookupContext context)