### Question:
Consumers { public static <T> Consumer<T> filter(final Predicate<T> filter, final Consumer<T> consumer) { checkNotNull(filter); checkNotNull(consumer); return item -> { if (filter.apply(item)) { consumer.accept(item); } }; } private  Consumers(); static Consumer<T> combine(List<Consumer<T>> consumers); static Consumer<T> filter(final Predicate<T> filter, final Consumer<T> consumer); @SuppressWarnings("unchecked") static Consumer<T> noop();  }### Answer:
@Test public void testFilter() { Predicate<Integer> filter = createMock(new Clazz<Predicate<Integer>>() { }); Consumer<Integer> work = createMock(INT_CLOSURE_CLZ); expect(filter.apply(1)).andReturn(true); work.accept(1); expect(filter.apply(2)).andReturn(false); Consumer<Integer> filtered = Consumers.filter(filter, work); control.replay(); filtered.accept(1); filtered.accept(2); }