@Test public void onLoadOnlyOncePerView() { SimplePresenter presenter = new SimplePresenter(); SomeView view = new SomeView(); presenter.takeView(view); assertThat(presenter.loaded).isTrue(); presenter.loaded = false; BundleServiceRunner.getBundleServiceRunner(activityScope).onCreate(null); assertThat(presenter.loaded).isFalse(); }
public final void takeView(V view) { if (view == null) throw new NullPointerException("new view must not be null"); if (this.view != view) { if (this.view != null) dropView(this.view); this.view = view; extractBundleService(view).register(registration); } }
Presenter { public final void takeView(V view) { if (view == null) throw new NullPointerException("new view must not be null"); if (this.view != view) { if (this.view != null) dropView(this.view); this.view = view; extractBundleService(view).register(registration); } } }
Presenter { public final void takeView(V view) { if (view == null) throw new NullPointerException("new view must not be null"); if (this.view != view) { if (this.view != null) dropView(this.view); this.view = view; extractBundleService(view).register(registration); } }  }
Presenter { public final void takeView(V view) { if (view == null) throw new NullPointerException("new view must not be null"); if (this.view != view) { if (this.view != null) dropView(this.view); this.view = view; extractBundleService(view).register(registration); } }  final void takeView(V view); void dropView(V view); }
Presenter { public final void takeView(V view) { if (view == null) throw new NullPointerException("new view must not be null"); if (this.view != view) { if (this.view != null) dropView(this.view); this.view = view; extractBundleService(view).register(registration); } }  final void takeView(V view); void dropView(V view);  }