@Test public void testCreate() { final DataType dataType = mock(DataType.class); final List<DataType> expectedAffectedDataTypes = asList(mock(DataType.class), mock(DataType.class)); final ItemDefinition itemDefinition = mock(ItemDefinition.class); when(itemDefinitionCreateHandler.appendItemDefinition()).thenReturn(itemDefinition); when(dataTypeCreateHandler.append(dataType, itemDefinition)).thenReturn(expectedAffectedDataTypes); final List<DataType> actualAffectedDataTypes = recordEngine.create(dataType); assertEquals(expectedAffectedDataTypes, actualAffectedDataTypes); }
@Override public List<DataType> create(final DataType dataType) { return dataTypeCreateHandler.append(dataType, itemDefinitionCreateHandler.appendItemDefinition()); }
ItemDefinitionRecordEngine implements DataTypeRecordEngine { @Override public List<DataType> create(final DataType dataType) { return dataTypeCreateHandler.append(dataType, itemDefinitionCreateHandler.appendItemDefinition()); } }
ItemDefinitionRecordEngine implements DataTypeRecordEngine { @Override public List<DataType> create(final DataType dataType) { return dataTypeCreateHandler.append(dataType, itemDefinitionCreateHandler.appendItemDefinition()); } @Inject  ItemDefinitionRecordEngine(final ItemDefinitionStore itemDefinitionStore,
                                      final ItemDefinitionDestroyHandler itemDefinitionDestroyHandler,
                                      final ItemDefinitionUpdateHandler itemDefinitionUpdateHandler,
                                      final ItemDefinitionCreateHandler itemDefinitionCreateHandler,
                                      final DataTypeDestroyHandler dataTypeDestroyHandler,
                                      final DataTypeUpdateHandler dataTypeUpdateHandler,
                                      final DataTypeCreateHandler dataTypeCreateHandler,
                                      final DataTypeNameValidator dataTypeNameValidator); }
ItemDefinitionRecordEngine implements DataTypeRecordEngine { @Override public List<DataType> create(final DataType dataType) { return dataTypeCreateHandler.append(dataType, itemDefinitionCreateHandler.appendItemDefinition()); } @Inject  ItemDefinitionRecordEngine(final ItemDefinitionStore itemDefinitionStore,
                                      final ItemDefinitionDestroyHandler itemDefinitionDestroyHandler,
                                      final ItemDefinitionUpdateHandler itemDefinitionUpdateHandler,
                                      final ItemDefinitionCreateHandler itemDefinitionCreateHandler,
                                      final DataTypeDestroyHandler dataTypeDestroyHandler,
                                      final DataTypeUpdateHandler dataTypeUpdateHandler,
                                      final DataTypeCreateHandler dataTypeCreateHandler,
                                      final DataTypeNameValidator dataTypeNameValidator); @PostConstruct void init(); @Override List<DataType> update(final DataType dataType); @Override List<DataType> destroy(final DataType dataType); @Override List<DataType> destroyWithoutDependentTypes(final DataType dataType); @Override List<DataType> create(final DataType dataType); @Override List<DataType> create(final DataType record,
                                 final DataType reference,
                                 final CreationType creationType); @Override boolean isValid(final DataType dataType); void doUpdate(final DataType dataType,
                         final ItemDefinition itemDefinition); void doDestroy(final DataType dataType); }
ItemDefinitionRecordEngine implements DataTypeRecordEngine { @Override public List<DataType> create(final DataType dataType) { return dataTypeCreateHandler.append(dataType, itemDefinitionCreateHandler.appendItemDefinition()); } @Inject  ItemDefinitionRecordEngine(final ItemDefinitionStore itemDefinitionStore,
                                      final ItemDefinitionDestroyHandler itemDefinitionDestroyHandler,
                                      final ItemDefinitionUpdateHandler itemDefinitionUpdateHandler,
                                      final ItemDefinitionCreateHandler itemDefinitionCreateHandler,
                                      final DataTypeDestroyHandler dataTypeDestroyHandler,
                                      final DataTypeUpdateHandler dataTypeUpdateHandler,
                                      final DataTypeCreateHandler dataTypeCreateHandler,
                                      final DataTypeNameValidator dataTypeNameValidator); @PostConstruct void init(); @Override List<DataType> update(final DataType dataType); @Override List<DataType> destroy(final DataType dataType); @Override List<DataType> destroyWithoutDependentTypes(final DataType dataType); @Override List<DataType> create(final DataType dataType); @Override List<DataType> create(final DataType record,
                                 final DataType reference,
                                 final CreationType creationType); @Override boolean isValid(final DataType dataType); void doUpdate(final DataType dataType,
                         final ItemDefinition itemDefinition); void doDestroy(final DataType dataType);  }