@Test public void verifyDocSaved_onSaveAppSelected() { verify(viewMock).addAppInfoSelectedEventHandler(Matchers.<AppInfoSelectedEvent.AppInfoSelectedEventHandler>any()); uut.isDocUpdate = false; SaveAppSelected eventMock = mock(SaveAppSelected.class); App appMock = mock(App.class); AppDoc docMock = mock(AppDoc.class); when(appMock.getName()).thenReturn("mock name"); when(docMock.getDocumentation()).thenReturn("mock documentation"); when(eventMock.getApp()).thenReturn(appMock); when(eventMock.getDoc()).thenReturn(docMock); uut.onSaveAppSelected(eventMock); verify(appMock).getName(); verify(viewMock).mask(anyString()); verify(adminAppServiceMock).updateApp(eq(appMock), Matchers.<AsyncCallback<App>>any()); verify(docMock).getDocumentation(); verify(adminAppServiceMock).saveAppDoc(eq(appMock), eq(docMock), Matchers.<AsyncCallback<AppDoc>>any()); verifyNoMoreInteractions(viewMock, adminAppServiceMock, appMock, docMock); verifyZeroInteractions(appServiceMock); }
@Override public void onSaveAppSelected(SaveAppSelected event) { final App app = event.getApp(); final AppDoc doc = event.getDoc(); if (app.getName() != null) { view.mask(appearance.saveAppLoadingMask()); adminAppService.updateApp(app, new AsyncCallback<App>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(App result) { view.unmask(); listStore.update(result); updateBetaStatus(app); } }); } if(!Strings.isNullOrEmpty(doc.getDocumentation())) { if (isDocUpdate) { adminAppService.updateAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } else { adminAppService.saveAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } } }
AdminAppsGridPresenterImpl implements AdminAppsGridView.Presenter,
                                                   AppInfoSelectedEvent.AppInfoSelectedEventHandler,
                                                   SaveAppSelected.SaveAppSelectedHandler { @Override public void onSaveAppSelected(SaveAppSelected event) { final App app = event.getApp(); final AppDoc doc = event.getDoc(); if (app.getName() != null) { view.mask(appearance.saveAppLoadingMask()); adminAppService.updateApp(app, new AsyncCallback<App>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(App result) { view.unmask(); listStore.update(result); updateBetaStatus(app); } }); } if(!Strings.isNullOrEmpty(doc.getDocumentation())) { if (isDocUpdate) { adminAppService.updateAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } else { adminAppService.saveAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } } } }
AdminAppsGridPresenterImpl implements AdminAppsGridView.Presenter,
                                                   AppInfoSelectedEvent.AppInfoSelectedEventHandler,
                                                   SaveAppSelected.SaveAppSelectedHandler { @Override public void onSaveAppSelected(SaveAppSelected event) { final App app = event.getApp(); final AppDoc doc = event.getDoc(); if (app.getName() != null) { view.mask(appearance.saveAppLoadingMask()); adminAppService.updateApp(app, new AsyncCallback<App>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(App result) { view.unmask(); listStore.update(result); updateBetaStatus(app); } }); } if(!Strings.isNullOrEmpty(doc.getDocumentation())) { if (isDocUpdate) { adminAppService.updateAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } else { adminAppService.saveAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } } } @Inject  AdminAppsGridPresenterImpl(final AdminAppsGridViewFactory viewFactory,
                               final ListStore<App> listStore); }
AdminAppsGridPresenterImpl implements AdminAppsGridView.Presenter,
                                                   AppInfoSelectedEvent.AppInfoSelectedEventHandler,
                                                   SaveAppSelected.SaveAppSelectedHandler { @Override public void onSaveAppSelected(SaveAppSelected event) { final App app = event.getApp(); final AppDoc doc = event.getDoc(); if (app.getName() != null) { view.mask(appearance.saveAppLoadingMask()); adminAppService.updateApp(app, new AsyncCallback<App>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(App result) { view.unmask(); listStore.update(result); updateBetaStatus(app); } }); } if(!Strings.isNullOrEmpty(doc.getDocumentation())) { if (isDocUpdate) { adminAppService.updateAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } else { adminAppService.saveAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } } } @Inject  AdminAppsGridPresenterImpl(final AdminAppsGridViewFactory viewFactory,
                               final ListStore<App> listStore); @Override HandlerRegistration addStoreRemoveHandler(StoreRemoveEvent.StoreRemoveHandler<App> handler); @Override void fireEvent(GwtEvent<?> event); @Override AdminAppsGridView getView(); @Override App getAppFromElement(Element eventTarget); @Override List<App> getSelectedApps(); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onAppInfoSelected(final AppInfoSelectedEvent event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onDeleteAppsSelected(final DeleteAppsSelected event); @Override void onRestoreAppSelected(final RestoreAppSelected event); @Override void onSaveAppSelected(SaveAppSelected event); void updateBetaStatus(final App app); }
AdminAppsGridPresenterImpl implements AdminAppsGridView.Presenter,
                                                   AppInfoSelectedEvent.AppInfoSelectedEventHandler,
                                                   SaveAppSelected.SaveAppSelectedHandler { @Override public void onSaveAppSelected(SaveAppSelected event) { final App app = event.getApp(); final AppDoc doc = event.getDoc(); if (app.getName() != null) { view.mask(appearance.saveAppLoadingMask()); adminAppService.updateApp(app, new AsyncCallback<App>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(App result) { view.unmask(); listStore.update(result); updateBetaStatus(app); } }); } if(!Strings.isNullOrEmpty(doc.getDocumentation())) { if (isDocUpdate) { adminAppService.updateAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } else { adminAppService.saveAppDoc(app, doc, new DocSaveCallback(announcer, appearance)); } } } @Inject  AdminAppsGridPresenterImpl(final AdminAppsGridViewFactory viewFactory,
                               final ListStore<App> listStore); @Override HandlerRegistration addStoreRemoveHandler(StoreRemoveEvent.StoreRemoveHandler<App> handler); @Override void fireEvent(GwtEvent<?> event); @Override AdminAppsGridView getView(); @Override App getAppFromElement(Element eventTarget); @Override List<App> getSelectedApps(); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onAppInfoSelected(final AppInfoSelectedEvent event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onDeleteAppsSelected(final DeleteAppsSelected event); @Override void onRestoreAppSelected(final RestoreAppSelected event); @Override void onSaveAppSelected(SaveAppSelected event); void updateBetaStatus(final App app);  }