@Test public void resolve_strategyReturnsEmptyList_resolveReturnListIsEmpty() { ResolveStrategy strategy = mockStrategy(); when(strategy.resolve(any(LookupContext.class))).thenReturn(Collections.<SagaInstanceInfo>emptyList()); Collection<SagaInstanceInfo> instances = sut.resolve(null); assertThat("Expected an empty list.", instances, hasSize(0)); }
@Override public Collection<SagaInstanceInfo> resolve(final LookupContext context) { Collection<SagaInstanceInfo> allInstances = new ArrayList<>(); Collection<ResolveStrategy> resolveStrategies = strategyFinder.find(context); for (ResolveStrategy strategy : resolveStrategies) { Collection<SagaInstanceInfo> resolvedInstances = strategy.resolve(context); allInstances.addAll(resolvedInstances); } return allInstances; }
StrategyInstanceResolver implements InstanceResolver { @Override public Collection<SagaInstanceInfo> resolve(final LookupContext context) { Collection<SagaInstanceInfo> allInstances = new ArrayList<>(); Collection<ResolveStrategy> resolveStrategies = strategyFinder.find(context); for (ResolveStrategy strategy : resolveStrategies) { Collection<SagaInstanceInfo> resolvedInstances = strategy.resolve(context); allInstances.addAll(resolvedInstances); } return allInstances; } }
StrategyInstanceResolver implements InstanceResolver { @Override public Collection<SagaInstanceInfo> resolve(final LookupContext context) { Collection<SagaInstanceInfo> allInstances = new ArrayList<>(); Collection<ResolveStrategy> resolveStrategies = strategyFinder.find(context); for (ResolveStrategy strategy : resolveStrategies) { Collection<SagaInstanceInfo> resolvedInstances = strategy.resolve(context); allInstances.addAll(resolvedInstances); } return allInstances; } @Inject  StrategyInstanceResolver(final StrategyFinder strategyFinder); }
StrategyInstanceResolver implements InstanceResolver { @Override public Collection<SagaInstanceInfo> resolve(final LookupContext context) { Collection<SagaInstanceInfo> allInstances = new ArrayList<>(); Collection<ResolveStrategy> resolveStrategies = strategyFinder.find(context); for (ResolveStrategy strategy : resolveStrategies) { Collection<SagaInstanceInfo> resolvedInstances = strategy.resolve(context); allInstances.addAll(resolvedInstances); } return allInstances; } @Inject  StrategyInstanceResolver(final StrategyFinder strategyFinder); @Override Collection<SagaInstanceInfo> resolve(final LookupContext context); }
StrategyInstanceResolver implements InstanceResolver { @Override public Collection<SagaInstanceInfo> resolve(final LookupContext context) { Collection<SagaInstanceInfo> allInstances = new ArrayList<>(); Collection<ResolveStrategy> resolveStrategies = strategyFinder.find(context); for (ResolveStrategy strategy : resolveStrategies) { Collection<SagaInstanceInfo> resolvedInstances = strategy.resolve(context); allInstances.addAll(resolvedInstances); } return allInstances; } @Inject  StrategyInstanceResolver(final StrategyFinder strategyFinder); @Override Collection<SagaInstanceInfo> resolve(final LookupContext context);  }