public void removeProvider() { providerService.call(response -> { notification.fire(new NotificationEvent(view.getRemoveProviderSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(provider.getKey().getProviderTypeKey())); }, (message, throwable) -> { notification.fire(new NotificationEvent(view.getRemoveProviderErrorMessage(), NotificationEvent.NotificationType.ERROR)); providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(provider.getKey().getProviderTypeKey())); return false; }).deleteProvider(provider.getKey()); }
public void removeProvider() { providerService.call(response -> { notification.fire(new NotificationEvent(view.getRemoveProviderSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(provider.getKey().getProviderTypeKey())); }, (message, throwable) -> { notification.fire(new NotificationEvent(view.getRemoveProviderErrorMessage(), NotificationEvent.NotificationType.ERROR)); providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(provider.getKey().getProviderTypeKey())); return false; }).deleteProvider(provider.getKey()); }
private void testRemoveProvider(boolean withErrors) { //emulate that the provider was previously loaded. prepareRuntimesInfo(); presenter.onProviderSelected(new ProviderSelectedEvent(providerKey)); when(view.getRemoveProviderSuccessMessage()).thenReturn(SUCCESS_MESSAGE); when(view.getRemoveProviderErrorMessage()).thenReturn(ERROR_MESSAGE); if (withErrors) { //make the providerService fail. prepareServiceCallerError(providerService, providerServiceCaller); } //the user confirms the delete operation at a later time from the ui. presenter.removeProvider(); verify(providerService, times(1)).deleteProvider(providerKey); verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(providerKey.getProviderTypeKey())); if (withErrors) { verify(notification, times(1)).fire(new NotificationEvent(ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR)); } else { verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); } }
private void testRemoveProvider(boolean withErrors) { //emulate that the provider was previously loaded. prepareRuntimesInfo(); presenter.onProviderSelected(new ProviderSelectedEvent(providerKey)); when(view.getRemoveProviderSuccessMessage()).thenReturn(SUCCESS_MESSAGE); when(view.getRemoveProviderErrorMessage()).thenReturn(ERROR_MESSAGE); if (withErrors) { //make the providerService fail. prepareServiceCallerError(providerService, providerServiceCaller); } //the user confirms the delete operation at a later time from the ui. presenter.removeProvider(); verify(providerService, times(1)).deleteProvider(providerKey); verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(providerKey.getProviderTypeKey())); if (withErrors) { verify(notification, times(1)).fire(new NotificationEvent(ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR)); } else { verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); } }