@Test public void verifyServiceCalled_onEditWorkflowSelected() { EditWorkflowSelected eventMock = mock(EditWorkflowSelected.class); App workflowMock = mock(App.class); when(workflowMock.getId()).thenReturn("mock id"); when(eventMock.getWorkFlow()).thenReturn(workflowMock); uut.onEditWorkflowSelected(eventMock); verify(appServiceMock).editWorkflow(eq(workflowMock), stringCallbackCaptor.capture()); stringCallbackCaptor.getValue().onSuccess("{}"); ArgumentCaptor<EditWorkflowEvent> editWorkflowCaptor = ArgumentCaptor.forClass(EditWorkflowEvent.class); verify(eventBusMock).fireEvent(editWorkflowCaptor.capture()); assertEquals(workflowMock, editWorkflowCaptor.getValue().getWorkflowToEdit()); verifyNoMoreInteractions(appServiceMock, eventBusMock); }
@Override public void onEditWorkflowSelected(final EditWorkflowSelected event) { final App workFlow = event.getWorkFlow(); appService.editWorkflow(workFlow, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.failToRetrieveApp(), caught); announcer.schedule(new ErrorAnnouncementConfig(appearance.failToRetrieveApp())); } @Override public void onSuccess(String result) { Splittable serviceWorkflowJson = StringQuoter.split(result); eventBus.fireEvent(new EditWorkflowEvent(workFlow, serviceWorkflowJson)); } }); }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditWorkflowSelected(final EditWorkflowSelected event) { final App workFlow = event.getWorkFlow(); appService.editWorkflow(workFlow, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.failToRetrieveApp(), caught); announcer.schedule(new ErrorAnnouncementConfig(appearance.failToRetrieveApp())); } @Override public void onSuccess(String result) { Splittable serviceWorkflowJson = StringQuoter.split(result); eventBus.fireEvent(new EditWorkflowEvent(workFlow, serviceWorkflowJson)); } }); } }
AppsToolbarPresenterImpl implements AppsToolbarView.Presenter,
                                                 CreateNewAppSelected.CreateNewAppSelectedHandler,
                                                 CreateNewWorkflowSelected.CreateNewWorkflowSelectedHandler,
                                                 EditAppSelected.EditAppSelectedHandler,
                                                 RequestToolSelected.RequestToolSelectedHandler,
                                     EditWorkflowSelected.EditWorkflowSelectedHandler,
                                     ShareAppsSelected.ShareAppsSelectedHandler { @Override public void onEditWorkflowSelected(final EditWorkflowSelected event) { final App workFlow = event.getWorkFlow(); appService.editWorkflow(workFlow, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.failToRetrieveApp(), caught); announcer.schedule(new ErrorAnnouncementConfig(appearance.failToRetrieveApp())); } @Override public void onSuccess(String result) { Splittable serviceWorkflowJson = StringQuoter.split(result); eventBus.fireEvent(new EditWorkflowEvent(workFlow, serviceWorkflowJson)); } }); } @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 onEditWorkflowSelected(final EditWorkflowSelected event) { final App workFlow = event.getWorkFlow(); appService.editWorkflow(workFlow, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.failToRetrieveApp(), caught); announcer.schedule(new ErrorAnnouncementConfig(appearance.failToRetrieveApp())); } @Override public void onSuccess(String result) { Splittable serviceWorkflowJson = StringQuoter.split(result); eventBus.fireEvent(new EditWorkflowEvent(workFlow, serviceWorkflowJson)); } }); } @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 onEditWorkflowSelected(final EditWorkflowSelected event) { final App workFlow = event.getWorkFlow(); appService.editWorkflow(workFlow, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.failToRetrieveApp(), caught); announcer.schedule(new ErrorAnnouncementConfig(appearance.failToRetrieveApp())); } @Override public void onSuccess(String result) { Splittable serviceWorkflowJson = StringQuoter.split(result); eventBus.fireEvent(new EditWorkflowEvent(workFlow, serviceWorkflowJson)); } }); } @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);  }