@Test public void testIfDataTypeDoesNotHaveLostSubDataTypesWhenItemDefinitionItemComponentIsEmpty() { final DataType dataType = mock(DataType.class); final ItemDefinition itemDefinition = mock(ItemDefinition.class); final List<ItemDefinition> itemComponent = singletonList(mock(ItemDefinition.class)); final Command onSuccess = mock(Command.class); final Command onError = mock(Command.class); final String uuid = "uuid"; when(dataType.getUUID()).thenReturn(uuid); when(dataType.getType()).thenReturn(STRUCTURE); when(itemDefinitionStore.get(uuid)).thenReturn(itemDefinition); when(itemDefinition.getItemComponent()).thenReturn(itemComponent); confirmation.ifDataTypeDoesNotHaveLostSubDataTypes(dataType, onSuccess, onError); verify(onSuccess).execute(); }
public void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType, final Command onSuccess, final Command onError) { if (hasLostSubDataTypes(dataType)) { flashMessageEvent.fire(dataTypeHasFieldsWarningMessage.getFlashMessage(dataType, onSuccess, onError)); } else { onSuccess.execute(); } }
DataTypeConfirmation { public void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType, final Command onSuccess, final Command onError) { if (hasLostSubDataTypes(dataType)) { flashMessageEvent.fire(dataTypeHasFieldsWarningMessage.getFlashMessage(dataType, onSuccess, onError)); } else { onSuccess.execute(); } } }
DataTypeConfirmation { public void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType, final Command onSuccess, final Command onError) { if (hasLostSubDataTypes(dataType)) { flashMessageEvent.fire(dataTypeHasFieldsWarningMessage.getFlashMessage(dataType, onSuccess, onError)); } else { onSuccess.execute(); } } @Inject  DataTypeConfirmation(final DataTypeStore dataTypeStore,
                                final ItemDefinitionStore itemDefinitionStore,
                                final Event<FlashMessage> flashMessageEvent,
                                final DataTypeHasFieldsWarningMessage dataTypeHasFieldsWarningMessage,
                                final ReferencedDataTypeWarningMessage referencedDataTypeWarningMessage,
                                final TranslationService translationService); }
DataTypeConfirmation { public void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType, final Command onSuccess, final Command onError) { if (hasLostSubDataTypes(dataType)) { flashMessageEvent.fire(dataTypeHasFieldsWarningMessage.getFlashMessage(dataType, onSuccess, onError)); } else { onSuccess.execute(); } } @Inject  DataTypeConfirmation(final DataTypeStore dataTypeStore,
                                final ItemDefinitionStore itemDefinitionStore,
                                final Event<FlashMessage> flashMessageEvent,
                                final DataTypeHasFieldsWarningMessage dataTypeHasFieldsWarningMessage,
                                final ReferencedDataTypeWarningMessage referencedDataTypeWarningMessage,
                                final TranslationService translationService); void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType,
                                                      final Command onSuccess,
                                                      final Command onError); void ifIsNotReferencedDataType(final DataType dataType,
                                          final Command onSuccess); }
DataTypeConfirmation { public void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType, final Command onSuccess, final Command onError) { if (hasLostSubDataTypes(dataType)) { flashMessageEvent.fire(dataTypeHasFieldsWarningMessage.getFlashMessage(dataType, onSuccess, onError)); } else { onSuccess.execute(); } } @Inject  DataTypeConfirmation(final DataTypeStore dataTypeStore,
                                final ItemDefinitionStore itemDefinitionStore,
                                final Event<FlashMessage> flashMessageEvent,
                                final DataTypeHasFieldsWarningMessage dataTypeHasFieldsWarningMessage,
                                final ReferencedDataTypeWarningMessage referencedDataTypeWarningMessage,
                                final TranslationService translationService); void ifDataTypeDoesNotHaveLostSubDataTypes(final DataType dataType,
                                                      final Command onSuccess,
                                                      final Command onError); void ifIsNotReferencedDataType(final DataType dataType,
                                          final Command onSuccess);  }