NucleusLayout extends FrameLayout implements ViewWithPresenter<P> { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); presenterDelegate.onDestroy(getActivity().isFinishing()); } NucleusLayout(Context context);  NucleusLayout(Context context, AttributeSet attrs);  NucleusLayout(Context context, AttributeSet attrs, int defStyle); PresenterFactory<P> getPresenterFactory(); @Override void setPresenterFactory(PresenterFactory<P> presenterFactory); P getPresenter(); Activity getActivity();  }
@Test public void testDestroy() throws Exception { setUpIsFinishing(true); tested.onDetachedFromWindow(); verify(mockDelegate, times(1)).onPause(true); }