RequireScrollMixin implements Mixin { public void requireScrollWithButton( @NonNull Button button, @StringRes int moreText, @Nullable OnClickListener onClickListener) { requireScrollWithButton(button, button.getContext().getText(moreText), onClickListener); } 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();  }
@SuppressLint("SetTextI18n") @Test public void testRequireScrollWithButton() { final Button button = new Button(application); button.setText("OriginalLabel"); OnClickListener wrappedListener = mock(OnClickListener.class); mRequireScrollMixin.requireScrollWithButton( button, "TestMoreLabel", wrappedListener); assertEquals("Button label should be kept initially", "OriginalLabel", button.getText()); mRequireScrollMixin.notifyScrollabilityChange(true); assertEquals("TestMoreLabel", button.getText()); button.performClick(); verify(wrappedListener, never()).onClick(eq(button)); verify(mDelegate).pageScrollDown(); mRequireScrollMixin.notifyScrollabilityChange(false); assertEquals("OriginalLabel", button.getText()); button.performClick(); verify(wrappedListener).onClick(eq(button)); }