RequireScrollMixin implements Mixin { public OnClickListener createOnClickListener(@Nullable final OnClickListener listener) { return new OnClickListener() { @Override public void onClick(View view) { if (mRequiringScrollToBottom) { mDelegate.pageScrollDown(); } else if (listener != null) { listener.onClick(view); } } }; } RequireScrollMixin(@NonNull TemplateLayout templateLayout); void setScrollHandlingDelegate(@NonNull ScrollHandlingDelegate delegate); void setOnRequireScrollStateChangedListener(
            @Nullable OnRequireScrollStateChangedListener listener); OnRequireScrollStateChangedListener getOnRequireScrollStateChangedListener(); OnClickListener createOnClickListener(@Nullable final OnClickListener listener); void requireScrollWithNavigationBar(@NonNull final NavigationBar navigationBar); void requireScrollWithButton(
            @NonNull Button button,
            @StringRes int moreText,
            @Nullable OnClickListener onClickListener); void requireScrollWithButton(
            @NonNull final Button button,
            final CharSequence moreText,
            @Nullable OnClickListener onClickListener); boolean isScrollingRequired(); void requireScroll();  }
@Test public void testCreateOnClickListener() { OnClickListener wrappedListener = mock(OnClickListener.class); final OnClickListener onClickListener = mRequireScrollMixin.createOnClickListener(wrappedListener); mRequireScrollMixin.notifyScrollabilityChange(true); onClickListener.onClick(null); verify(wrappedListener, never()).onClick(any(View.class)); verify(mDelegate).pageScrollDown(); mRequireScrollMixin.notifyScrollabilityChange(false); onClickListener.onClick(null); verify(wrappedListener).onClick(any(View.class)); }