@Test public void testDoValidateDataTypeNameAndSave() { final DataType dataType = spy(makeDataType()); final Command saveAndCloseEditMode = mock(Command.class); doReturn(saveAndCloseEditMode).when(listItem).doSaveAndCloseEditMode(dataType); listItem.doValidateDataTypeNameAndSave(dataType).execute(); verify(nameFormatValidator).ifIsValid(dataType, saveAndCloseEditMode); }
Command doValidateDataTypeNameAndSave(final DataType dataType) { return () -> nameFormatValidator.ifIsValid(dataType, doSaveAndCloseEditMode(dataType)); }
DataTypeListItem { Command doValidateDataTypeNameAndSave(final DataType dataType) { return () -> nameFormatValidator.ifIsValid(dataType, doSaveAndCloseEditMode(dataType)); } }
DataTypeListItem { Command doValidateDataTypeNameAndSave(final DataType dataType) { return () -> nameFormatValidator.ifIsValid(dataType, doSaveAndCloseEditMode(dataType)); } @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); }
DataTypeListItem { Command doValidateDataTypeNameAndSave(final DataType dataType) { return () -> nameFormatValidator.ifIsValid(dataType, doSaveAndCloseEditMode(dataType)); } @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); }
DataTypeListItem { Command doValidateDataTypeNameAndSave(final DataType dataType) { return () -> nameFormatValidator.ifIsValid(dataType, doSaveAndCloseEditMode(dataType)); } @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);  }