### Question:
Selectors { public static <T> SelectorFunction<Collection<T>, T> filtered(@NonNull final SelectorFunction<Collection<T>, T> selector, @NonNull final Predicate<T> predicate) { return new SelectorFunction<Collection<T>, T>() { @Override public T select(Collection<T> items) { return selector.select( filteredItems(items, predicate) ); } }; }  @SafeVarargs static SelectorFunction<Input, Output> firstAvailable(@NonNull final SelectorFunction<Input, Output> function,
                                                         final SelectorFunction<Input, Output>... functions); static SelectorFunction<Collection<T>, T> filtered(@NonNull final SelectorFunction<Collection<T>, T> selector,
                                                   @NonNull final Predicate<T> predicate); static SelectorFunction<Collection<T>, T> single(final T preference); static SelectorFunction<Input, Output> nothing();  }### Answer:
@Test public void filtered() throws Exception { SelectorFunction<Collection<String>, String> function = Selectors.filtered( functionA, new Predicate<String>() { @Override public boolean condition(@Nullable String value) { return value != null && value.startsWith("A"); } } ); given(functionA.select(ArgumentMatchers.<String>anyCollection())) .willReturn("A"); String result = function.select(asList("A", "B", "AB")); assertEquals("A", result); verify(functionA).select(asSet("A", "AB")); }