PopupPresenter extends Presenter<Popup<D, R>> { public void show(D info) { if (whatToShow == info || whatToShow != null && whatToShow.equals(info)) { return; } whatToShow = info; if (!hasView()) return; getView().show(whatToShow, WITH_FLOURISH, this); } protected  PopupPresenter(String customStateKey); protected  PopupPresenter(); D showing(); void show(D info); void dismiss(); final void onDismissed(R result); @Override void dropView(Popup<D, R> view); @Override void onLoad(Bundle savedInstanceState); @Override void onSave(Bundle outState); @Override void onExitScope();  }
@Test public void takeViewDoesNotShowView() { presenter.takeView(view); verify(view, never()).show(any(Parcelable.class), anyBoolean(), any(TestPopupPresenter.class)); }
@Test public void showAfterTakeViewShowsView() { presenter.takeView(view); Parcelable info = mock(Parcelable.class); presenter.show(info); verify(view).show(same(info), eq(WITH_FLOURISH), same(presenter)); }
@Test public void showTwiceWithSameInfoDebounces() { presenter.takeView(view); Parcelable info = mock(Parcelable.class); presenter.show(info); presenter.show(info); verify(view).show(same(info), anyBoolean(), same(presenter)); }
@Test public void takeViewRestoresPopup() { presenter.takeView(view); Parcelable info = mock(Parcelable.class); presenter.show(info); Bundle state = new Bundle(); getBundleServiceRunner(activityScope).onSaveInstanceState(state); newProcess(); getBundleServiceRunner(activityScope).onCreate(state); presenter = new TestPopupPresenter(); presenter.takeView(view); verify(view).show(same(info), eq(WITHOUT_FLOURISH), same(presenter)); }