### Question:
EnableState extends BinaryState { @Override public void attach(@NonNull final StateDraweeView view) { view.setOnEnabledListener(new StateDraweeView.OnEnabledListener() { @Override public void onEnableChange(@NonNull View view1, final boolean enabled) { setDrawable((StateDraweeView) view1); } }); setDrawable(view); }  @Override void attach(@NonNull final StateDraweeView view); @Override void detach(@NonNull final StateDraweeView view);  }### Answer:
@Test public void test_Attach() { StateDraweeView view = Mockito.spy(new StateDraweeView(RuntimeEnvironment.application)); EnableState state = new EnableState(); state.add(BinaryState.STATE_OFF, R.drawable.ui_ic_clear); state.add(BinaryState.STATE_ON, R.drawable.ui_ic_clear); state.attach(view); Mockito.verify(view).setOnEnabledListener(Mockito.any(StateDraweeView.OnEnabledListener.class)); }