@Test public void verifyEventFired_onEditAppSelected() { final String emailMock = "user@email.com"; EditAppSelected eventMock = mock(EditAppSelected.class); App appMock = mock(App.class); when(appMock.isPublic()).thenReturn(true); when(eventMock.getApp()).thenReturn(appMock); when(appMock.getIntegratorEmail()).thenReturn(emailMock); when(userInfoMock.getEmail()).thenReturn(emailMock); uut.onEditAppSelected(eventMock); ArgumentCaptor<EditAppEvent> editAppEventCaptor = ArgumentCaptor.forClass(EditAppEvent.class); verify(eventBusMock).fireEvent(editAppEventCaptor.capture()); assertEquals(appMock, editAppEventCaptor.getValue().getAppToEdit()); assertEquals(true, editAppEventCaptor.getValue().isUserIntegratorAndAppPublic()); verifyNoMoreInteractions(eventBusMock); verifyZeroInteractions(appServiceMock); }
@Override public void onEditAppSelected(EditAppSelected event) { final App app = event.getApp(); boolean isAppPublished = app.isPublic(); boolean isCurrentUserAppIntegrator = userInfo.getEmail().equals(app.getIntegratorEmail()); eventBus.fireEvent(new EditAppEvent(app, isAppPublished && isCurrentUserAppIntegrator)); }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditAppSelected(EditAppSelected event) { final App app = event.getApp(); boolean isAppPublished = app.isPublic(); boolean isCurrentUserAppIntegrator = userInfo.getEmail().equals(app.getIntegratorEmail()); eventBus.fireEvent(new EditAppEvent(app, isAppPublished && isCurrentUserAppIntegrator)); } }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditAppSelected(EditAppSelected event) { final App app = event.getApp(); boolean isAppPublished = app.isPublic(); boolean isCurrentUserAppIntegrator = userInfo.getEmail().equals(app.getIntegratorEmail()); eventBus.fireEvent(new EditAppEvent(app, isAppPublished && isCurrentUserAppIntegrator)); } @Inject  AppsToolbarPresenterImpl(final AppUserServiceFacade appService,
                             final AppsToolbarViewFactory viewFactory); }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditAppSelected(EditAppSelected event) { final App app = event.getApp(); boolean isAppPublished = app.isPublic(); boolean isCurrentUserAppIntegrator = userInfo.getEmail().equals(app.getIntegratorEmail()); eventBus.fireEvent(new EditAppEvent(app, isAppPublished && isCurrentUserAppIntegrator)); } @Inject  AppsToolbarPresenterImpl(final AppUserServiceFacade appService,
                             final AppsToolbarViewFactory viewFactory); @Override HandlerRegistration addAppSearchResultLoadEventHandler(AppSearchResultLoadEvent.AppSearchResultLoadEventHandler handler); @Override HandlerRegistration addBeforeLoadHandler(BeforeLoadEvent.BeforeLoadHandler<FilterPagingLoadConfig> handler); @Override AppsToolbarView getView(); @Override void onCreateNewAppSelected(CreateNewAppSelected event); @Override void onCreateNewWorkflowSelected(CreateNewWorkflowSelected event); @Override void onEditAppSelected(EditAppSelected event); @Override void onEditWorkflowSelected(final EditWorkflowSelected event); @Override void onRequestToolSelected(RequestToolSelected event); @Override void onShareAppSelected(ShareAppsSelected event); }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditAppSelected(EditAppSelected event) { final App app = event.getApp(); boolean isAppPublished = app.isPublic(); boolean isCurrentUserAppIntegrator = userInfo.getEmail().equals(app.getIntegratorEmail()); eventBus.fireEvent(new EditAppEvent(app, isAppPublished && isCurrentUserAppIntegrator)); } @Inject  AppsToolbarPresenterImpl(final AppUserServiceFacade appService,
                             final AppsToolbarViewFactory viewFactory); @Override HandlerRegistration addAppSearchResultLoadEventHandler(AppSearchResultLoadEvent.AppSearchResultLoadEventHandler handler); @Override HandlerRegistration addBeforeLoadHandler(BeforeLoadEvent.BeforeLoadHandler<FilterPagingLoadConfig> handler); @Override AppsToolbarView getView(); @Override void onCreateNewAppSelected(CreateNewAppSelected event); @Override void onCreateNewWorkflowSelected(CreateNewWorkflowSelected event); @Override void onEditAppSelected(EditAppSelected event); @Override void onEditWorkflowSelected(final EditWorkflowSelected event); @Override void onRequestToolSelected(RequestToolSelected event); @Override void onShareAppSelected(ShareAppsSelected event);  }