DataObjectFieldPickerItem implements DataObjectFieldPickerItemView.Presenter,
                                                  IsWidget { @Override public void onFieldRemoved(ObjectProperty objectProperty) { for (int i = objectPropertyPath.getObjectPropertyPath().size() - 1; i >= 0; i--) { ObjectProperty currentObjectProperty = objectPropertyPath.getObjectPropertyPath().get(i); objectPropertyPath.getObjectPropertyPath().remove(i); view.removeLastFieldItem(); if (currentObjectProperty.equals(objectProperty)) { break; } } DataObject dataObject; if (objectPropertyPath.getObjectPropertyPath().isEmpty()) { dataObject = rootDataObject; } else { ObjectProperty parentObjectProperty = objectPropertyPath.getObjectPropertyPath().get(objectPropertyPath.getObjectPropertyPath().size() - 1); dataObject = dataModel.getDataObject(parentObjectProperty.getClassName()); } initSelectFieldDropdownOptions(dataObject); view.displaySelectFieldButton(true); picker.objectPropertyPathChanged(true); } @Inject  DataObjectFieldPickerItem(DataObjectFieldPickerItemView view); void init(DataModel dataModel,
                     DataObject rootDataObject,
                     DataObjectFieldPicker picker); @Override void onFieldAdded(ObjectProperty objectProperty,
                             boolean notify); @Override void onFieldRemoved(ObjectProperty objectProperty); @Override void onRootLabelRemoved(); @Override void onMoveFieldItemUp(); @Override void onMoveFieldItemDown(); @Override void onOrderSelectValueChange(boolean descending,
                                         boolean notify); @Override void setFieldPickerItemIndex(int index); ObjectPropertyPath getObjectPropertyPath(); @Override Widget asWidget();  }
@Test public void onFieldRemoved() { fieldPickerItem.init(dataModel, dataObject, fieldPicker); ObjectProperty objectProperty = mock(ObjectProperty.class); when(objectProperty.getName()).thenReturn("testProperty"); when(objectProperty.getClassName()).thenReturn("java.lang.Integer"); when(objectProperty.isBaseType()).thenReturn(true); when(objectProperty.isPrimitiveType()).thenReturn(false); when(dataObject.getProperty("testProperty")).thenReturn(objectProperty); fieldPickerItem.onFieldAdded(objectProperty, true); Mockito.reset(view, fieldPicker); fieldPickerItem.onFieldRemoved(objectProperty); verify(view, times(1)).removeLastFieldItem(); verify(view, times(1)).displaySelectFieldButton(true); verify(view, times(1)).initSelectFieldDropdownOptions(anyList()); verify(fieldPicker, times(1)).objectPropertyPathChanged(true); }