ServiceTasksRepositoryListPresenter { public void openRemoveServiceTaskConfirmPopup(ServiceTaskSummary serviceTaskSummary) { if (serviceTaskSummary.getInstalledOn().size() > 0) { cannotRemovePopup.alert(constants.RemoveServiceTaskTitle(), constants.CanNotRemoveServiceTaskMessage(serviceTaskSummary.getName())); } else { confirmPopup.show(constants.RemoveServiceTaskTitle(), constants.RemoveServiceTaskAction(), constants.RemoveServiceTaskConfirmMessage(serviceTaskSummary.getName()), () -> refreshServiceTaskList(serviceTaskSummary)); } } ServiceTasksRepositoryListPresenter(); @Inject  ServiceTasksRepositoryListPresenter(final Event<NotificationEvent> notificationEvent, final ServiceTasksRepositoryListView view,
                                               final Caller<ServiceTaskService> serviceTaskService, final SyncBeanManager iocManager); @WorkbenchPartTitle String getTitle(); @PostConstruct void init(); @WorkbenchPartView ServiceTasksRepositoryListView getView(); @Inject void setConfirmPopup(final ConfirmPopup confirmPopup); @Inject void setCannotRemovePopup(final AlertPopupView cannotRemovePopup); void enableService(String id); void disableService(String id); void openUploadDialog(); void openRemoveServiceTaskConfirmPopup(ServiceTaskSummary serviceTaskSummary); static final String SCREEN_ID; }
@Test public void openRemoveServiceTaskConfirmPopupTestWhenCanNotRemove() { Set<String> installOn = new HashSet<>(); installOn.add("branch1"); installOn.add("branch2"); ServiceTaskSummary st = initServiceTaskSummary(TEST_ST_NAME, TEST_ST_ID); st.setInstalledOn(installOn); presenter.openRemoveServiceTaskConfirmPopup(st); verify(cannotRemovePopup).alert(any(), any()); verify(serviceTaskService, never()).removeServiceTask(any()); assertEquals(3, serviceTaskSummaries.size()); }