@Test public void testDiscardDataTypeProperties() { final DataType dataType = spy(makeDataType()); final String expectedName = "name"; final String expectedType = "type"; final String expectedConstraint = "constraint"; final String expectedConstraintType = "enumeration"; final boolean expectedIsList = true; doReturn(dataType).when(listItem).getDataType(); doReturn(expectedName).when(listItem).getOldName(); doReturn(expectedType).when(listItem).getOldType(); doReturn(expectedConstraint).when(listItem).getOldConstraint(); doReturn(expectedIsList).when(listItem).getOldIsList(); doReturn(expectedConstraintType).when(listItem).getOldConstraintType(); listItem.discardDataTypeProperties(); assertEquals(expectedName, dataType.getName()); assertEquals(expectedType, dataType.getType()); assertEquals(expectedConstraint, dataType.getConstraint()); assertEquals(expectedIsList, dataType.isList()); assertEquals(expectedConstraintType, dataType.getConstraintType().value()); }
DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); }
DataTypeListItem { DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); } }
DataTypeListItem { DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); } @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 { DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); } @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 { DataType discardDataTypeProperties() { return dataTypeManager .withDataType(getDataType()) .withName(getOldName()) .withType(getOldType()) .withConstraint(getOldConstraint()) .withConstraintType(getOldConstraintType()) .asList(getOldIsList()) .get(); } @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);  }