NextButton extends LinearLayout { public void enable() { this.setClickable(true); nextButtonText.setTextColor(ContextCompat.getColor(getContext(), R.color.primaryTextColor)); nextButtonImage.setBackgroundResource(R.drawable.forward_arrow); } NextButton(Context context);  NextButton(Context context, AttributeSet attrs);  NextButton(Context context, AttributeSet attrs, int defStyleAttr); @TargetApi(Build.VERSION_CODES.LOLLIPOP)  NextButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes); void disable(); void enable();  }
@Test public void shouldEnableNextButton() { nextButton.enable(); assertTrue(nextButton.isClickable()); TextView nextButtonLabelText = (TextView) nextButton.findViewById(R.id.next_button_text); assertEquals(getColor(nextButton.getContext(), R.color.primaryTextColor), nextButtonLabelText.getCurrentTextColor()); ImageView nextButtonImage = (ImageView) nextButton.findViewById(R.id.next_button_image); assertEquals(R.drawable.forward_arrow, shadowOf(nextButtonImage.getBackground()).getCreatedFromResId()); }