DataObjectFieldPickerItemViewImpl extends Composite implements DataObjectFieldPickerItemView { @Override public void addRootItem(DataObject rootDataObject) { createFieldPickerItemLabel(rootDataObject.getName(), () -> presenter.onRootLabelRemoved()); } @Inject  DataObjectFieldPickerItemViewImpl(final Div fieldPickerItemRow,
                                             final ManagedInstance<DataObjectFieldPickerItemLabelView> fieldPickerItemLabelViewInstance); @PostConstruct void init(); @Override void setPresenter(Presenter presenter); @Override void initSelectFieldDropdownOptions(List<ObjectProperty> options); @Override void addRootItem(DataObject rootDataObject); @Override void addFieldItem(ObjectProperty objectProperty); @Override void removeLastFieldItem(); @Override void displaySelectFieldButton(boolean display); @Override void setOrderSelectDescendingValue(boolean descending); @Override void setFieldPickerItemIndex(int index); @EventHandler("moveUpButton") void onMoveUpButtonClicked(ClickEvent event); @EventHandler("moveDownButton") void onMoveDownButtonClicked(ClickEvent event); @EventHandler("ascSortButton") void onAscSortButtonClicked(ClickEvent event); @EventHandler("descSortButton") void onDescSortButtonClicked(ClickEvent event);  }
@Test public void addRootItem() { DataObject dataObject = mock(DataObject.class); when(dataObject.getName()).thenReturn("testDataObject"); DataObjectFieldPickerItemLabelView labelView = mock(DataObjectFieldPickerItemLabelView.class); when(fieldPickerItemLabelViewInstance.get()).thenReturn(labelView); view.addRootItem(dataObject); verify(labelView).setName("testDataObject"); verify(fieldPickerItemRow).appendChild(labelView.getElement()); }