PartStackPresenter implements Presenter, PartStackView.ActionDelegate, PartStack { @Override public void removePart(PartPresenter part) { close(part); } @Inject  PartStackPresenter(EventBus eventBus,
                              PartStackEventHandler partStackEventHandler,
                              @Assisted final PartStackView view,
                              @Assisted WorkBenchPartController workBenchPartController); @Override void go(AcceptsOneWidget container); @Override void addPart(PartPresenter part); @Override void addPart(PartPresenter part, Constraints constraint); @Override boolean containsPart(PartPresenter part); @Override int getNumberOfParts(); @Override PartPresenter getActivePart(); @Override void setActivePart(PartPresenter part); List<PartPresenter> getPartPresenters(); @Override void hidePart(PartPresenter part); @Override void removePart(PartPresenter part); @Override void onRequestFocus(); @Override void setFocus(boolean focused);  }
@Test public void testRemovePartWhenSuccess() { presenter.parts.add(part); presenter.removePart(part); verify(part).onClose(asyncCallbackCaptor.capture()); AsyncCallback<Void> asyncCallback = asyncCallbackCaptor.getValue(); asyncCallback.onSuccess(null); verify(view).removeTab(eq(0)); assertThat(presenter.parts).isEmpty(); assertThat(presenter.constraints).isEmpty(); verify(part).removePropertyListener((PropertyListener)anyObject()); }
@Test public void testRemoveActivePart() { presenter.parts.add(part); presenter.activePart = part; presenter.removePart(part); verify(part).onClose(asyncCallbackCaptor.capture()); AsyncCallback<Void> asyncCallback = asyncCallbackCaptor.getValue(); asyncCallback.onSuccess(null); verify(view).setActiveTab(eq(-1)); verify(view).removeTab(eq(0)); assertThat(presenter.parts).isEmpty(); assertThat(presenter.constraints).isEmpty(); verify(part).removePropertyListener((PropertyListener)anyObject()); }