ConditionalAdapter extends PowerAdapter { @Override public void bindView( @NonNull Container container, @NonNull View v, @NonNull Holder holder, @NonNull List<Object> payloads ) { adapter().bindView(container, v, holder, payloads); } ConditionalAdapter(@NonNull PowerAdapter adapter, @NonNull Condition condition); @Override int getItemCount(); @Override boolean hasStableIds(); @Override long getItemId(int position); @NonNull @Override Object getItemViewType(int position); @Override boolean isEnabled(int position); @NonNull @Override View newView(@NonNull ViewGroup parent, @NonNull Object viewType); @Override void bindView(
            @NonNull Container container,
            @NonNull View v,
            @NonNull Holder holder,
            @NonNull List<Object> payloads
    );  }
@Test public void parentDelegatesBindViewToChildWhileConditionIsTrue() { setCondition(always()); mConditionalAdapter.bindView(mContainer, mItemView, holder(2), emptyList()); verify(mFakeAdapter).bindView(eq(mContainer), eq(mItemView), argThat(holderWithPosition(2)), anyList()); assertItemCountConsistent(); }
@Test(expected = Throwable.class) public void parentThrowsFromBindViewWhileConditionIsFalse() { setCondition(Condition.never()); mConditionalAdapter.bindView(mContainer, mItemView, holder(5), emptyList()); assertItemCountConsistent(); }