@Test public void testPrepareAllSelectionPoliciesWithNoDriverSelectionPolicy() { WaitingQueriesSelectionPolicy p1 = mock(WaitingQueriesSelectionPolicy.class); WaitingQueriesSelectionPolicy p2 = mock(WaitingQueriesSelectionPolicy.class); final ImmutableSet<WaitingQueriesSelectionPolicy> emptySet = ImmutableSet.copyOf( Sets.<WaitingQueriesSelectionPolicy>newHashSet()); FinishedLensQuery mockFinishedQuery = mock(FinishedLensQuery.class); when(mockFinishedQuery.getDriverSelectionPolicies()).thenReturn(emptySet); UnioningWaitingQueriesSelector selector = new UnioningWaitingQueriesSelector(ImmutableSet.of(p1, p2)); assertEquals(selector.prepareAllSelectionPolicies(mockFinishedQuery), ImmutableSet.of(p1, p2)); }
@VisibleForTesting Set<WaitingQueriesSelectionPolicy> prepareAllSelectionPolicies(final FinishedLensQuery finishedQuery) { ImmutableSet<WaitingQueriesSelectionPolicy> driverSelectionPolicies = finishedQuery.getDriverSelectionPolicies(); return Sets.union(this.selectionPolicies, driverSelectionPolicies); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @VisibleForTesting Set<WaitingQueriesSelectionPolicy> prepareAllSelectionPolicies(final FinishedLensQuery finishedQuery) { ImmutableSet<WaitingQueriesSelectionPolicy> driverSelectionPolicies = finishedQuery.getDriverSelectionPolicies(); return Sets.union(this.selectionPolicies, driverSelectionPolicies); } }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @VisibleForTesting Set<WaitingQueriesSelectionPolicy> prepareAllSelectionPolicies(final FinishedLensQuery finishedQuery) { ImmutableSet<WaitingQueriesSelectionPolicy> driverSelectionPolicies = finishedQuery.getDriverSelectionPolicies(); return Sets.union(this.selectionPolicies, driverSelectionPolicies); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @VisibleForTesting Set<WaitingQueriesSelectionPolicy> prepareAllSelectionPolicies(final FinishedLensQuery finishedQuery) { ImmutableSet<WaitingQueriesSelectionPolicy> driverSelectionPolicies = finishedQuery.getDriverSelectionPolicies(); return Sets.union(this.selectionPolicies, driverSelectionPolicies); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); @Override Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery,
      final EstimatedImmutableQueryCollection waitingQueries); }
UnioningWaitingQueriesSelector implements WaitingQueriesSelector { @VisibleForTesting Set<WaitingQueriesSelectionPolicy> prepareAllSelectionPolicies(final FinishedLensQuery finishedQuery) { ImmutableSet<WaitingQueriesSelectionPolicy> driverSelectionPolicies = finishedQuery.getDriverSelectionPolicies(); return Sets.union(this.selectionPolicies, driverSelectionPolicies); } UnioningWaitingQueriesSelector(
    @NonNull final ImmutableSet<WaitingQueriesSelectionPolicy> selectionPolicies); @Override Set<QueryContext> selectQueries(final FinishedLensQuery finishedQuery,
      final EstimatedImmutableQueryCollection waitingQueries);  }