### Question:
DataTypeListItem { void discardNewDataType() { final DataType oldDataType = discardDataTypeProperties(); view.setDataType(oldDataType); setupListComponent(); setupSelectComponent(); setupConstraintComponent(); setupIndentationLevel(); refreshSubItems(oldDataType.getSubDataTypes(), true); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); void init(final DataTypeList dataTypeList); DataType getDataType(); boolean isReadOnly(); int getLevel(); boolean isCollapsed(); void expand(); void collapse(); void enableEditMode(); void disableEditMode(); void saveAndCloseEditMode(); void remove(); Command removeItem(); Command destroy(); void destroyWithDependentTypes(); void destroyWithoutDependentTypes(); String getType(); void insertFieldAbove(); String insertFieldAbove(final DataType dataType); void insertFieldBelow(); String insertFieldBelow(final DataType dataType); void insertNestedField(); void insertNestedField(final DataType newDataType); HTMLElement getDragAndDropElement(); void highlightLevel(final DataType dataType);  }### Answer:
@Test public void testDiscardNewDataType() { final DataType dataType = spy(makeDataType()); final List<DataType> subDataTypes = Collections.emptyList(); doNothing().when(listItem).setupSelectComponent(); doNothing().when(listItem).setupListComponent(); doNothing().when(listItem).setupIndentationLevel(); doNothing().when(listItem).refreshSubItems(subDataTypes, true); doReturn(subDataTypes).when(dataType).getSubDataTypes(); doReturn(dataType).when(listItem).discardDataTypeProperties(); listItem.discardNewDataType(); verify(view).setDataType(dataType); verify(listItem).setupListComponent(); verify(listItem).setupSelectComponent(); verify(listItem).setupConstraintComponent(); verify(listItem).refreshSubItems(subDataTypes, true); verify(listItem).setupIndentationLevel(); }