@Test public void testUpdateDataType() { final String parentUUID = "parentUUID"; final DataType dataType = mock(DataType.class); final DataType expectedUpdateDataType = mock(DataType.class); final ItemDefinition itemDefinition = mock(ItemDefinition.class); final DataTypeManager dataTypeManagerWithDataType = mock(DataTypeManager.class); final DataTypeManager dataTypeManagerWithParentUUID = mock(DataTypeManager.class); final DataTypeManager dataTypeManagerWithItemDefinition = mock(DataTypeManager.class); final DataTypeManager dataTypeManagerWithIndexedItemDefinition = mock(DataTypeManager.class); final DataTypeManager dataTypeManagerWithItemDefinitionSubDataTypes = mock(DataTypeManager.class); final DataTypeManager dataTypeManagerWithUniqueName = mock(DataTypeManager.class); when(dataTypeManager.withDataType(dataType)).thenReturn(dataTypeManagerWithDataType); when(dataTypeManagerWithDataType.withParentUUID(parentUUID)).thenReturn(dataTypeManagerWithParentUUID); when(dataTypeManagerWithParentUUID.withItemDefinition(itemDefinition)).thenReturn(dataTypeManagerWithItemDefinition); when(dataTypeManagerWithItemDefinition.withIndexedItemDefinition()).thenReturn(dataTypeManagerWithIndexedItemDefinition); when(dataTypeManagerWithIndexedItemDefinition.withItemDefinitionSubDataTypes()).thenReturn(dataTypeManagerWithItemDefinitionSubDataTypes); when(dataTypeManagerWithItemDefinitionSubDataTypes.withUniqueName()).thenReturn(dataTypeManagerWithUniqueName); when(dataTypeManagerWithUniqueName.get()).thenReturn(expectedUpdateDataType); final DataType actualUpdatedDataType = handler.updateDataTypeProperties(dataType, parentUUID, itemDefinition); assertEquals(expectedUpdateDataType, actualUpdatedDataType); }
DataType updateDataTypeProperties(final DataType dataType, final String newParentUUID, final ItemDefinition newItemDefinition) { return dataTypeManager .withDataType(dataType) .withParentUUID(newParentUUID) .withItemDefinition(newItemDefinition) .withIndexedItemDefinition() .withItemDefinitionSubDataTypes() .withUniqueName() .get(); }
DataTypeCreateHandler extends DataTypeHandler { DataType updateDataTypeProperties(final DataType dataType, final String newParentUUID, final ItemDefinition newItemDefinition) { return dataTypeManager .withDataType(dataType) .withParentUUID(newParentUUID) .withItemDefinition(newItemDefinition) .withIndexedItemDefinition() .withItemDefinitionSubDataTypes() .withUniqueName() .get(); } }
DataTypeCreateHandler extends DataTypeHandler { DataType updateDataTypeProperties(final DataType dataType, final String newParentUUID, final ItemDefinition newItemDefinition) { return dataTypeManager .withDataType(dataType) .withParentUUID(newParentUUID) .withItemDefinition(newItemDefinition) .withIndexedItemDefinition() .withItemDefinitionSubDataTypes() .withUniqueName() .get(); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); }
DataTypeCreateHandler extends DataTypeHandler { DataType updateDataTypeProperties(final DataType dataType, final String newParentUUID, final ItemDefinition newItemDefinition) { return dataTypeManager .withDataType(dataType) .withParentUUID(newParentUUID) .withItemDefinition(newItemDefinition) .withIndexedItemDefinition() .withItemDefinitionSubDataTypes() .withUniqueName() .get(); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); List<DataType> append(final DataType dataType,
                                 final ItemDefinition itemDefinition); List<DataType> insertSibling(final DataType dataType,
                                        final DataType reference,
                                        final CreationType creationType,
                                        final ItemDefinition itemDefinition); List<DataType> insertNested(final DataType dataType,
                                       final DataType reference,
                                       final ItemDefinition itemDefinition); }
DataTypeCreateHandler extends DataTypeHandler { DataType updateDataTypeProperties(final DataType dataType, final String newParentUUID, final ItemDefinition newItemDefinition) { return dataTypeManager .withDataType(dataType) .withParentUUID(newParentUUID) .withItemDefinition(newItemDefinition) .withIndexedItemDefinition() .withItemDefinitionSubDataTypes() .withUniqueName() .get(); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); List<DataType> append(final DataType dataType,
                                 final ItemDefinition itemDefinition); List<DataType> insertSibling(final DataType dataType,
                                        final DataType reference,
                                        final CreationType creationType,
                                        final ItemDefinition itemDefinition); List<DataType> insertNested(final DataType dataType,
                                       final DataType reference,
                                       final ItemDefinition itemDefinition);  }