@Test public void testSaveMembers_NoFailures() { when(stringListMock.isEmpty()).thenReturn(true); when(memberSaveResultMock.getFailures()).thenReturn(stringListMock); when(memberSaveResultMock.getMembers()).thenReturn(memberListMock); uut.saveMembers(memberListMock); verify(viewMock).mask(eq(appearanceMock.loadingMask())); verify(serviceFacadeMock).saveMembers(eq(memberListMock), memberSaveCallbackCaptor.capture()); memberSaveCallbackCaptor.getValue().onSuccess(memberSaveResultMock); verify(listStoreMock).replaceAll(eq(memberListMock)); verify(viewMock).unmask(); }
void saveMembers(List<Member> members) { view.mask(appearance.loadingMask()); serviceFacade.saveMembers(members, new AsyncCallback<MemberSaveResult>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmask(); } @Override public void onSuccess(MemberSaveResult result) { if (!result.getFailures().isEmpty()) { ErrorHandler.post(appearance.partialGroupSaveMsg()); } listStore.replaceAll(result.getMembers()); view.unmask(); } }); }
WorkshopAdminPresenterImpl implements WorkshopAdminView.Presenter { void saveMembers(List<Member> members) { view.mask(appearance.loadingMask()); serviceFacade.saveMembers(members, new AsyncCallback<MemberSaveResult>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmask(); } @Override public void onSuccess(MemberSaveResult result) { if (!result.getFailures().isEmpty()) { ErrorHandler.post(appearance.partialGroupSaveMsg()); } listStore.replaceAll(result.getMembers()); view.unmask(); } }); } }
WorkshopAdminPresenterImpl implements WorkshopAdminView.Presenter { void saveMembers(List<Member> members) { view.mask(appearance.loadingMask()); serviceFacade.saveMembers(members, new AsyncCallback<MemberSaveResult>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmask(); } @Override public void onSuccess(MemberSaveResult result) { if (!result.getFailures().isEmpty()) { ErrorHandler.post(appearance.partialGroupSaveMsg()); } listStore.replaceAll(result.getMembers()); view.unmask(); } }); } @Inject  WorkshopAdminPresenterImpl(final WorkshopAdminViewFactory viewFactory,
                                      final WorkshopAdminServiceFacade serviceFacade,
                                      final GroupAutoBeanFactory groupAutoBeanFactory,
                                      final MemberProperties memberProperties,
                                      final WorkshopAdminView.WorkshopAdminViewAppearance appearance); }
WorkshopAdminPresenterImpl implements WorkshopAdminView.Presenter { void saveMembers(List<Member> members) { view.mask(appearance.loadingMask()); serviceFacade.saveMembers(members, new AsyncCallback<MemberSaveResult>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmask(); } @Override public void onSuccess(MemberSaveResult result) { if (!result.getFailures().isEmpty()) { ErrorHandler.post(appearance.partialGroupSaveMsg()); } listStore.replaceAll(result.getMembers()); view.unmask(); } }); } @Inject  WorkshopAdminPresenterImpl(final WorkshopAdminViewFactory viewFactory,
                                      final WorkshopAdminServiceFacade serviceFacade,
                                      final GroupAutoBeanFactory groupAutoBeanFactory,
                                      final MemberProperties memberProperties,
                                      final WorkshopAdminView.WorkshopAdminViewAppearance appearance); @Override void go(HasOneWidget container); @Override void setViewDebugId(String baseId); }
WorkshopAdminPresenterImpl implements WorkshopAdminView.Presenter { void saveMembers(List<Member> members) { view.mask(appearance.loadingMask()); serviceFacade.saveMembers(members, new AsyncCallback<MemberSaveResult>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmask(); } @Override public void onSuccess(MemberSaveResult result) { if (!result.getFailures().isEmpty()) { ErrorHandler.post(appearance.partialGroupSaveMsg()); } listStore.replaceAll(result.getMembers()); view.unmask(); } }); } @Inject  WorkshopAdminPresenterImpl(final WorkshopAdminViewFactory viewFactory,
                                      final WorkshopAdminServiceFacade serviceFacade,
                                      final GroupAutoBeanFactory groupAutoBeanFactory,
                                      final MemberProperties memberProperties,
                                      final WorkshopAdminView.WorkshopAdminViewAppearance appearance); @Override void go(HasOneWidget container); @Override void setViewDebugId(String baseId);  }