### Question:
PressState extends State { @Override public void attach(@NonNull final StateDraweeView view) { setDrawable(view, STATE_RELEASED); view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(final View v, final MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_BUTTON_PRESS: case MotionEvent.ACTION_DOWN: setDrawable((StateDraweeView) v, STATE_PRESSED); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_BUTTON_RELEASE: case MotionEvent.ACTION_UP: setDrawable((StateDraweeView) v, STATE_RELEASED); break; } return true; } }); }  @Override void attach(@NonNull final StateDraweeView view); @Override void detach(@NonNull final StateDraweeView view); static final int STATE_RELEASED; static final int STATE_PRESSED; }### Answer:
@Test public void test_Attach() { StateDraweeView view = Mockito.spy(new StateDraweeView(RuntimeEnvironment.application)); PressState state = new PressState(); state.add(PressState.STATE_RELEASED, R.drawable.ui_ic_clear); state.attach(view); Mockito.verify(view).setOnTouchListener(Mockito.any(View.OnTouchListener.class)); }