NimbleLinearLayout extends LinearLayout implements NimbleView { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); presenter().dropView(getMvpView()); if (getActivity().isFinishing()) { presenter().onDestroy(); } } NimbleLinearLayout(Context context);  NimbleLinearLayout(Context context, AttributeSet attrs);  NimbleLinearLayout(Context context, AttributeSet attrs, int defStyleAttr); Activity getActivity();  }
@Test public void onDetachedFromWindow_isNotFinish_nothing() throws Exception { prepareForOnDetachedFromWindows(false); layout.onDetachedFromWindow(); verify(presenter).dropView(layout); verifyNoMoreInteractions(presenter); }
@Test public void testOnDetachedFromWindow() throws Exception { prepareForOnDetachedFromWindows(false); layout.onDetachedFromWindow(); verify(presenter).dropView(layout); }
@Test public void onDetachedFromWindow_isFinish_presenterOnDestroy() throws Exception { prepareForOnDetachedFromWindows(true); layout.onDetachedFromWindow(); verify(presenter).onDestroy(); }