AppsEditorPresenterImpl implements AppsEditorView.Presenter,
                                                DeleteArgumentEventHandler,
                                                ArgumentAddedEventHandler,
                                                ArgumentGroupAddedEventHandler { @Override public void doArgumentGroupDelete(DeleteArgumentGroupEvent event) { AppTemplate flush = view.flush(); if (flush.getArgumentGroups().size() == 1) { announcer.schedule(new ErrorAnnouncementConfig(errorMessages.cannotDeleteLastArgumentGroup(), true, 3000)); return; } AutoBean<ArgumentGroup> autoBean = AutoBeanUtils.getAutoBean(event.getArgumentGroupToBeDeleted()); if (autoBean.getTag(AppsEditorView.Presenter.HANDLERS) != null) { List<HandlerRegistration> handlerRegs = autoBean.getTag(AppsEditorView.Presenter.HANDLERS); for (HandlerRegistration hr : handlerRegs) { hr.removeHandler(); } } view.getEditorDriver().accept(new DeleteArgumentGroup(event.getArgumentGroupToBeDeleted(), appearance)); } @Inject  AppsEditorPresenterImpl(final AppsEditorView view,
                            final EventBus eventBus,
                            final AppTemplateServices atService,
                            final AppIntegrationErrorMessages errorMessages,
                            final IplantDisplayStrings messages,
                            final UUIDServiceAsync uuidService,
                            final AppTemplateWizardAppearance appearance,
                            final IplantAnnouncer announcer,
                            final IplantErrorStrings errorStrings,
                            final AppTemplateUtils appTemplateUtils); static native void doJsonFormattting(XElement textArea,String val,int width, int height); @Override void doArgumentDelete(DeleteArgumentEvent event); @Override void doArgumentGroupDelete(DeleteArgumentGroupEvent event); @Override AppTemplate getAppTemplate(); @Override void go(HasOneWidget container); @Override void go(final HasOneWidget container, final AppTemplate appTemplate); @Override void setViewDebugId(String baseID); @Override void go(final HasOneWidget container, final AppTemplate appTemplate, final RenameWindowHeaderCommand renameCmd); @Override boolean isEditorDirty(); @Override boolean isLabelOnlyEditMode(); @Override void onArgumentAdded(ArgumentAddedEvent event); @Override void onArgumentGroupAdded(ArgumentGroupAddedEvent event); @Override void onArgumentOrderClicked(); @Override void onBeforeHide(final BeforeHideEvent event); @Override void onPreviewJsonClicked(); @Override void onPreviewUiClicked(); @Override void onSaveClicked(); @Override void onUpdateCommandLinePreview(UpdateCommandLinePreviewEvent event); @Override boolean orderingRequired(Argument arg); @Override void setBeforeHideHandlerRegistration(HandlerRegistration hr); @Override void setLabelOnlyEditMode(boolean onlyLabelEditMode);  }
@Test public void testDoArgumentGroupDelete() { AppTemplate mockAppTemplate = mock(AppTemplate.class); when(mockView.flush()).thenReturn(mockAppTemplate); when(mockAppTemplate.getArgumentGroups()).thenReturn(Lists.newArrayList(mock(ArgumentGroup.class))); DeleteArgumentGroupEvent mockEvent = mock(DeleteArgumentGroupEvent.class); uut.doArgumentGroupDelete(mockEvent); verify(mockAnnouncer).schedule(any(ErrorAnnouncementConfig.class)); verifyZeroInteractions(mockEventBus, mockAppTemplateService, mockUuidService, mockAppearance); verifyNoMoreInteractions(mockAnnouncer); }