@Test public void testPersist() { final String uuid = "uuid"; final DataType dataType = spy(makeDataType()); final ItemDefinition itemDefinition = mock(ItemDefinition.class); final List<DataType> subDataTypes = singletonList(makeDataType()); final List<DataType> affectedDataTypes = emptyList(); when(itemDefinitionStore.get(uuid)).thenReturn(itemDefinition); when(dataTypeSelectComponent.getSubDataTypes()).thenReturn(subDataTypes); doReturn(uuid).when(dataType).getUUID(); doReturn(affectedDataTypes).when(dataType).update(); listItem.persist(dataType); final InOrder inOrder = inOrder(dataTypeManager, dataType); inOrder.verify(dataTypeManager).from(dataType); inOrder.verify(dataTypeManager).withSubDataTypes(subDataTypes); inOrder.verify(dataTypeManager).get(); inOrder.verify(dataType).update(); }
List<DataType> persist(final DataType dataType) { return dataTypeManager .from(dataType) .withSubDataTypes(dataTypeSelectComponent.getSubDataTypes()) .get() .update(); }
DataTypeListItem { List<DataType> persist(final DataType dataType) { return dataTypeManager .from(dataType) .withSubDataTypes(dataTypeSelectComponent.getSubDataTypes()) .get() .update(); } }
DataTypeListItem { List<DataType> persist(final DataType dataType) { return dataTypeManager .from(dataType) .withSubDataTypes(dataTypeSelectComponent.getSubDataTypes()) .get() .update(); } @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 { List<DataType> persist(final DataType dataType) { return dataTypeManager .from(dataType) .withSubDataTypes(dataTypeSelectComponent.getSubDataTypes()) .get() .update(); } @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 { List<DataType> persist(final DataType dataType) { return dataTypeManager .from(dataType) .withSubDataTypes(dataTypeSelectComponent.getSubDataTypes()) .get() .update(); } @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);  }