GlobalsEditorPresenter extends KieEditor<GlobalsModel> { protected void onDelete() { validationService.call((validationMessages) -> { if (((List<ValidationMessage>) validationMessages).isEmpty()) { showDeletePopup(getVersionRecordManager().getCurrentPath()); } else { validationPopup.showDeleteValidationMessages(() -> showDeletePopup(versionRecordManager.getCurrentPath()), () -> { }, (List<ValidationMessage>) validationMessages); } }).validateForDelete(versionRecordManager.getCurrentPath()); } GlobalsEditorPresenter(); @Inject  GlobalsEditorPresenter(final GlobalsEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @Override void onSourceTabSelected(); @WorkbenchPartView IsWidget getWidget(); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); static final String EDITOR_ID; }
@Test public void deleteNoValidationErrors() { when(validationService.validateForDelete(any(Path.class))).thenReturn(Collections.emptyList()); presenter.onDelete(); verify(validationService, times(1)).validateForDelete(any(Path.class)); verify(deletePopUpPresenter, times(1)).show(eq(assetUpdateValidator), any(ParameterizedCommand.class)); }
@Test public void deleteValidationErrors() { when(validationService.validateForDelete(any(Path.class))).thenReturn(Arrays.asList(new ValidationMessage())); presenter.onDelete(); verify(validationService, times(1)).validateForDelete(any(Path.class)); verify(validationPopup, times(1)).showDeleteValidationMessages(any(Command.class), any(Command.class), anyListOf(ValidationMessage.class)); }