@Test public void scanHandledMessageTypes_sagaNotImplementingDescription_returnsEmpty() throws ExecutionException { when(typeScanner.scanForSagas()).thenReturn(Collections.singleton(com.codebullets.sagalib.TestSaga.class)); Map<Class<? extends Saga>, SagaHandlersMap> classSagaHandlersMapMap = sut.scanHandledMessageTypes(); assertThat("Expected map to be empty.", classSagaHandlersMapMap.isEmpty(), is(true)); }
@Override public Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes() { Collection<Class<? extends Saga>> sagaClasses = typeScanner.scanForSagas(); Stream<DescribesHandlers> directDescriptionSagas = sagaClasses.stream() .filter(DescribesHandlers.class::isAssignableFrom) .filter(c -> !Modifier.isAbstract(c.getModifiers())) .flatMap(this::createDirectDescriptionInstance); return createHandlersMap(directDescriptionSagas); }
HandlerDescriptionAnalyzer implements SagaAnalyzer { @Override public Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes() { Collection<Class<? extends Saga>> sagaClasses = typeScanner.scanForSagas(); Stream<DescribesHandlers> directDescriptionSagas = sagaClasses.stream() .filter(DescribesHandlers.class::isAssignableFrom) .filter(c -> !Modifier.isAbstract(c.getModifiers())) .flatMap(this::createDirectDescriptionInstance); return createHandlersMap(directDescriptionSagas); } }
HandlerDescriptionAnalyzer implements SagaAnalyzer { @Override public Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes() { Collection<Class<? extends Saga>> sagaClasses = typeScanner.scanForSagas(); Stream<DescribesHandlers> directDescriptionSagas = sagaClasses.stream() .filter(DescribesHandlers.class::isAssignableFrom) .filter(c -> !Modifier.isAbstract(c.getModifiers())) .flatMap(this::createDirectDescriptionInstance); return createHandlersMap(directDescriptionSagas); } @Inject  HandlerDescriptionAnalyzer(final TypeScanner typeScanner, final SagaInstanceCreator instanceCreator); }
HandlerDescriptionAnalyzer implements SagaAnalyzer { @Override public Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes() { Collection<Class<? extends Saga>> sagaClasses = typeScanner.scanForSagas(); Stream<DescribesHandlers> directDescriptionSagas = sagaClasses.stream() .filter(DescribesHandlers.class::isAssignableFrom) .filter(c -> !Modifier.isAbstract(c.getModifiers())) .flatMap(this::createDirectDescriptionInstance); return createHandlersMap(directDescriptionSagas); } @Inject  HandlerDescriptionAnalyzer(final TypeScanner typeScanner, final SagaInstanceCreator instanceCreator); @Override Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes(); }
HandlerDescriptionAnalyzer implements SagaAnalyzer { @Override public Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes() { Collection<Class<? extends Saga>> sagaClasses = typeScanner.scanForSagas(); Stream<DescribesHandlers> directDescriptionSagas = sagaClasses.stream() .filter(DescribesHandlers.class::isAssignableFrom) .filter(c -> !Modifier.isAbstract(c.getModifiers())) .flatMap(this::createDirectDescriptionInstance); return createHandlersMap(directDescriptionSagas); } @Inject  HandlerDescriptionAnalyzer(final TypeScanner typeScanner, final SagaInstanceCreator instanceCreator); @Override Map<Class<? extends Saga>, SagaHandlersMap> scanHandledMessageTypes();  }