PartStackPresenter implements Presenter, PartStackView.ActionDelegate, PartStack { @Override public void setActivePart(PartPresenter part) { if (activePart != null && activePart == part) { onRequestFocus(); return; } if (activePart != null && workBenchPartController != null) { double size = workBenchPartController.getSize(); partSizes.put(activePart, Double.valueOf(size)); } activePart = part; if (part == null) { view.setActiveTab(-1); workBenchPartController.setHidden(true); } else { view.setActiveTab(parts.indexOf(activePart)); } onRequestFocus(); if (activePart != null && workBenchPartController != null) { workBenchPartController.setHidden(false); if (partSizes.containsKey(activePart)) { workBenchPartController.setSize(partSizes.get(activePart)); } else { workBenchPartController.setSize(activePart.getSize()); } } } @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 testSetActivePartWhenPartIsNull() throws Exception { presenter.setActivePart(null); verify(view).setActiveTab(eq(-1)); verify(workBenchPartController).setHidden(eq(true)); }