@Test public void deleteWithWrongConfirmedNameTest() { presenter.organizationalUnit = mock(OrganizationalUnit.class); doReturn("ou-name").when(presenter.organizationalUnit).getName(); doReturn("other").when(view).getConfirmedName(); presenter.delete(); verify(view).getWrongConfirmedNameValidationMessage(); verify(view).showError(anyString()); verify(organizationalUnitService, never()).removeOrganizationalUnit(anyString()); }
public void delete() { final String confirmedName = view.getConfirmedName(); if (!organizationalUnit.getName().equals(confirmedName)) { view.showError(view.getWrongConfirmedNameValidationMessage()); return; } view.showBusyIndicator(view.getDeletingMessage()); organizationalUnitService.call(v -> { view.hideBusyIndicator(); notificationEvent.fire(new NotificationEvent(view.getDeleteSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); view.hide(); libraryPlaces.goToOrganizationalUnits(); }, new HasBusyIndicatorDefaultErrorCallback(view)).removeOrganizationalUnit(organizationalUnit.getName()); }
DeleteOrganizationalUnitPopUpPresenter { public void delete() { final String confirmedName = view.getConfirmedName(); if (!organizationalUnit.getName().equals(confirmedName)) { view.showError(view.getWrongConfirmedNameValidationMessage()); return; } view.showBusyIndicator(view.getDeletingMessage()); organizationalUnitService.call(v -> { view.hideBusyIndicator(); notificationEvent.fire(new NotificationEvent(view.getDeleteSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); view.hide(); libraryPlaces.goToOrganizationalUnits(); }, new HasBusyIndicatorDefaultErrorCallback(view)).removeOrganizationalUnit(organizationalUnit.getName()); } }
DeleteOrganizationalUnitPopUpPresenter { public void delete() { final String confirmedName = view.getConfirmedName(); if (!organizationalUnit.getName().equals(confirmedName)) { view.showError(view.getWrongConfirmedNameValidationMessage()); return; } view.showBusyIndicator(view.getDeletingMessage()); organizationalUnitService.call(v -> { view.hideBusyIndicator(); notificationEvent.fire(new NotificationEvent(view.getDeleteSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); view.hide(); libraryPlaces.goToOrganizationalUnits(); }, new HasBusyIndicatorDefaultErrorCallback(view)).removeOrganizationalUnit(organizationalUnit.getName()); } @Inject  DeleteOrganizationalUnitPopUpPresenter(final View view,
                                                  final Caller<OrganizationalUnitService> organizationalUnitService,
                                                  final OrganizationalUnitController organizationalUnitController,
                                                  final Event<NotificationEvent> notificationEvent,
                                                  final LibraryPlaces libraryPlaces); }
DeleteOrganizationalUnitPopUpPresenter { public void delete() { final String confirmedName = view.getConfirmedName(); if (!organizationalUnit.getName().equals(confirmedName)) { view.showError(view.getWrongConfirmedNameValidationMessage()); return; } view.showBusyIndicator(view.getDeletingMessage()); organizationalUnitService.call(v -> { view.hideBusyIndicator(); notificationEvent.fire(new NotificationEvent(view.getDeleteSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); view.hide(); libraryPlaces.goToOrganizationalUnits(); }, new HasBusyIndicatorDefaultErrorCallback(view)).removeOrganizationalUnit(organizationalUnit.getName()); } @Inject  DeleteOrganizationalUnitPopUpPresenter(final View view,
                                                  final Caller<OrganizationalUnitService> organizationalUnitService,
                                                  final OrganizationalUnitController organizationalUnitController,
                                                  final Event<NotificationEvent> notificationEvent,
                                                  final LibraryPlaces libraryPlaces); @PostConstruct void setup(); void show(final OrganizationalUnit organizationalUnit); void delete(); void cancel(); void onOrganizationalUnitRemoved(@Observes final RemoveOrganizationalUnitEvent removedOrganizationalUnitEvent); }
DeleteOrganizationalUnitPopUpPresenter { public void delete() { final String confirmedName = view.getConfirmedName(); if (!organizationalUnit.getName().equals(confirmedName)) { view.showError(view.getWrongConfirmedNameValidationMessage()); return; } view.showBusyIndicator(view.getDeletingMessage()); organizationalUnitService.call(v -> { view.hideBusyIndicator(); notificationEvent.fire(new NotificationEvent(view.getDeleteSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); view.hide(); libraryPlaces.goToOrganizationalUnits(); }, new HasBusyIndicatorDefaultErrorCallback(view)).removeOrganizationalUnit(organizationalUnit.getName()); } @Inject  DeleteOrganizationalUnitPopUpPresenter(final View view,
                                                  final Caller<OrganizationalUnitService> organizationalUnitService,
                                                  final OrganizationalUnitController organizationalUnitController,
                                                  final Event<NotificationEvent> notificationEvent,
                                                  final LibraryPlaces libraryPlaces); @PostConstruct void setup(); void show(final OrganizationalUnit organizationalUnit); void delete(); void cancel(); void onOrganizationalUnitRemoved(@Observes final RemoveOrganizationalUnitEvent removedOrganizationalUnitEvent);  }