@Test public void scanForSagas_reflectionsCtor_returnsEmptyListFromReflectionsParam() { Reflections reflections = mock(Reflections.class); when(reflections.getSubTypesOf(any(Class.class))).thenReturn(new HashSet<>()); ReflectionsTypeScanner sut = new ReflectionsTypeScanner(reflections); Collection<Class<? extends Saga>> foundSagas = sut.scanForSagas(); assertThat("Expected return value to be an empty list.", foundSagas.size(), equalTo(0)); }
@Override public Collection<Class<? extends Saga>> scanForSagas() { Set<Class<? extends Saga>> sagaTypes = reflections.getSubTypesOf(Saga.class); Set<Class<? extends AbstractSaga>> abstractSagaTypes = reflections.getSubTypesOf(AbstractSaga.class); Set<Class<? extends AbstractSingleEventSaga>> singleEventSagaTypes = reflections.getSubTypesOf(AbstractSingleEventSaga.class); Set<Class<? extends Saga>> foundTypes = Sets.union(sagaTypes, abstractSagaTypes); Set<Class<? extends Saga>> mergedSet = Sets.union(foundTypes, copy(singleEventSagaTypes)); return removeAbstractTypes(mergedSet); }
ReflectionsTypeScanner implements TypeScanner { @Override public Collection<Class<? extends Saga>> scanForSagas() { Set<Class<? extends Saga>> sagaTypes = reflections.getSubTypesOf(Saga.class); Set<Class<? extends AbstractSaga>> abstractSagaTypes = reflections.getSubTypesOf(AbstractSaga.class); Set<Class<? extends AbstractSingleEventSaga>> singleEventSagaTypes = reflections.getSubTypesOf(AbstractSingleEventSaga.class); Set<Class<? extends Saga>> foundTypes = Sets.union(sagaTypes, abstractSagaTypes); Set<Class<? extends Saga>> mergedSet = Sets.union(foundTypes, copy(singleEventSagaTypes)); return removeAbstractTypes(mergedSet); } }
ReflectionsTypeScanner implements TypeScanner { @Override public Collection<Class<? extends Saga>> scanForSagas() { Set<Class<? extends Saga>> sagaTypes = reflections.getSubTypesOf(Saga.class); Set<Class<? extends AbstractSaga>> abstractSagaTypes = reflections.getSubTypesOf(AbstractSaga.class); Set<Class<? extends AbstractSingleEventSaga>> singleEventSagaTypes = reflections.getSubTypesOf(AbstractSingleEventSaga.class); Set<Class<? extends Saga>> foundTypes = Sets.union(sagaTypes, abstractSagaTypes); Set<Class<? extends Saga>> mergedSet = Sets.union(foundTypes, copy(singleEventSagaTypes)); return removeAbstractTypes(mergedSet); } ReflectionsTypeScanner();  ReflectionsTypeScanner(final Reflections reflections); }
ReflectionsTypeScanner implements TypeScanner { @Override public Collection<Class<? extends Saga>> scanForSagas() { Set<Class<? extends Saga>> sagaTypes = reflections.getSubTypesOf(Saga.class); Set<Class<? extends AbstractSaga>> abstractSagaTypes = reflections.getSubTypesOf(AbstractSaga.class); Set<Class<? extends AbstractSingleEventSaga>> singleEventSagaTypes = reflections.getSubTypesOf(AbstractSingleEventSaga.class); Set<Class<? extends Saga>> foundTypes = Sets.union(sagaTypes, abstractSagaTypes); Set<Class<? extends Saga>> mergedSet = Sets.union(foundTypes, copy(singleEventSagaTypes)); return removeAbstractTypes(mergedSet); } ReflectionsTypeScanner();  ReflectionsTypeScanner(final Reflections reflections); @Override Collection<Class<? extends Saga>> scanForSagas(); }
ReflectionsTypeScanner implements TypeScanner { @Override public Collection<Class<? extends Saga>> scanForSagas() { Set<Class<? extends Saga>> sagaTypes = reflections.getSubTypesOf(Saga.class); Set<Class<? extends AbstractSaga>> abstractSagaTypes = reflections.getSubTypesOf(AbstractSaga.class); Set<Class<? extends AbstractSingleEventSaga>> singleEventSagaTypes = reflections.getSubTypesOf(AbstractSingleEventSaga.class); Set<Class<? extends Saga>> foundTypes = Sets.union(sagaTypes, abstractSagaTypes); Set<Class<? extends Saga>> mergedSet = Sets.union(foundTypes, copy(singleEventSagaTypes)); return removeAbstractTypes(mergedSet); } ReflectionsTypeScanner();  ReflectionsTypeScanner(final Reflections reflections); @Override Collection<Class<? extends Saga>> scanForSagas();  }