PartStackPresenter implements Presenter, PartStackView.ActionDelegate, PartStack { @Override public void addPart(PartPresenter part) { addPart(part, null); } @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 testAddPartWhenPartInstanceOfBasePresenter() throws Exception { BasePresenter part = mock(BasePresenter.class); when(view.addTab((SVGImage)anyObject(), anyString(), anyString(), (IsWidget)anyObject(), anyBoolean())) .thenReturn(mock(PartStackView.TabItem.class)); presenter.addPart(part); verify(part).setPartStack(eq(presenter)); assertThat(presenter.parts).hasSize(1).containsExactly(part); assertThat(presenter.constraints).hasSize(1); }
@Test public void testAddPart() throws Exception { when(view.addTab((SVGImage)anyObject(), anyString(), anyString(), (IsWidget)anyObject(), anyBoolean())) .thenReturn(mock(PartStackView.TabItem.class)); presenter.addPart(part); assertThat(presenter.parts).hasSize(1).containsExactly(part); assertThat(presenter.constraints).hasSize(1); verify(part).addPropertyListener(eq(presenter.propertyListener)); verify(part).getTitleSVGImage(); verify(view).addTab((SVGImage)anyObject(), anyString(), anyString(), (IsWidget)anyObject(), anyBoolean()); verify(part).go((AcceptsOneWidget)anyObject()); verify(part).onOpen(); }