### Question:
TreeListItemView implements TreeListItem.View { void setExpandVisibility(final TreeListItem item) { if (item.getSubItems().isEmpty()) { hideElement(expand); } else { showElement(expand); } } @Inject  TreeListItemView(final HTMLDivElement itemHeader,
                            final HTMLDivElement itemsContainer,
                            final HTMLDivElement itemDetails,
                            final HTMLDivElement expandContainer,
                            @Named("span") final HTMLElement expand,
                            final HTMLInputElement checkbox,
                            final HTMLDivElement itemRoot); TreeListItem getPresenter(); @Override void init(final TreeListItem presenter); @EventHandler("data-object-checkbox") void onCheckboxChanged(final ChangeEvent valueChanged); @EventHandler("item-header") void onClick(final ClickEvent e); void populate(final TreeListItem item); @Override HTMLElement getElement();  }### Answer:
@Test public void testSetExpandVisibility() { final TreeListItem item = mock(TreeListItem.class); final List<TreeListSubItem> subItems = new ArrayList<>(); when(item.getSubItems()).thenReturn(subItems); itemView.setExpandVisibility(item); verify(itemView).hideElement(expand); subItems.add(mock(TreeListSubItem.class)); itemView.setExpandVisibility(item); verify(itemView).showElement(expand); }