ListBarWidgetImpl extends ResizeComposite implements ListBarWidget { @Override public Collection<PartDefinition> getParts() { if (currentPart == null) { return parts; } LinkedList<PartDefinition> allParts = new LinkedList<>(); allParts.addAll(parts); allParts.addFirst(currentPart.getK1()); return Collections.unmodifiableList(allParts); }  @Override void enableDnd(); @Override void disableDnd(); @Override void setPresenter(final WorkbenchPanelPresenter presenter); @Override void setDndManager(final WorkbenchDragAndDropManager dndManager); @Override void clear(); @Override void addPart(final WorkbenchPartPresenter.View view); @Override void changeTitle(final PartDefinition part,
                            final String title,
                            final IsWidget titleDecoration); @Override boolean selectPart(final PartDefinition part); @Override boolean remove(final PartDefinition part); @Override void setFocus(final boolean hasFocus); @Override void addOnFocusHandler(final Command command); @Override int getPartsSize(); @Override Collection<PartDefinition> getParts(); @Override HandlerRegistration addBeforeSelectionHandler(final BeforeSelectionHandler<PartDefinition> handler); @Override HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler); @Override void onResize(); @Override MaximizeToggleButtonPresenter getMaximizeButton(); @Override boolean isDndEnabled(); @Override void enableClosePart(); @Override void disableClosePart(); @Override void disableExpandPart();  }
@Test public void partsIsAddedToListBarTest() { final PartDefinition firstPart = mock(PartDefinition.class); final PartDefinition secondPart = mock(PartDefinition.class); listBar.parts.add(firstPart); listBar.parts.add(secondPart); assertEquals(2, listBar.getParts().size()); }
@Test public void getPartsTest() { listBar.currentPart = Pair.newPair(getPartDefinition(false, false), null); listBar.parts = new LinkedList<>(); listBar.parts.add(getPartDefinition(false, false)); final List<PartDefinition> parts = (List<PartDefinition>) listBar.getParts(); assertSame(listBar.currentPart.getK1(), parts.get(0)); assertSame(listBar.parts.get(0), parts.get(1)); }