### Question:
TreeListItemView implements TreeListItem.View { void addSubItems(final TreeListItem item) { for (final TreeListSubItem sub : item.getSubItems()) { itemsContainer.appendChild(sub.getElement()); } } @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 testAddSubItems() { final TreeListItem item = mock(TreeListItem.class); final TreeListSubItem subItem1 = mock(TreeListSubItem.class); final Node element1 = mock(Node.class); when(subItem1.getElement()).thenReturn(element1); final TreeListSubItem subItem2 = mock(TreeListSubItem.class); final Node element2 = mock(Node.class); when(subItem2.getElement()).thenReturn(element2); final List<TreeListSubItem> subItems = Arrays.asList(subItem1, subItem2); when(item.getSubItems()).thenReturn(subItems); itemView.addSubItems(item); verify(itemsContainer).appendChild(element2); verify(itemsContainer).appendChild(element2); }