@Test public void testDeleteAndUpdateClientPayloadFails() { when(mDataManagerClient.deleteAndUpdatePayloads(1, clientCreationTime)) .thenReturn(Observable.<List<ClientPayload>>error(new RuntimeException())); syncClientPayloadsPresenter.deleteAndUpdateClientPayload(1, clientCreationTime); verify(mSyncClientPayloadsMvpView).showError(R.string.failed_to_update_list); verify(mSyncClientPayloadsMvpView, never()) .showPayloadDeletedAndUpdatePayloads(clientPayloads); }
public void deleteAndUpdateClientPayload(int id, long clientCreationTIme) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerClient.deleteAndUpdatePayloads(id, clientCreationTIme) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Observer<List<ClientPayload>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_update_list); } @Override public void onNext(List<ClientPayload> clientPayloads) { getMvpView().showProgressbar(false); getMvpView().showPayloadDeletedAndUpdatePayloads(clientPayloads); } })); }
SyncClientPayloadsPresenter extends BasePresenter<SyncClientPayloadsMvpView> { public void deleteAndUpdateClientPayload(int id, long clientCreationTIme) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerClient.deleteAndUpdatePayloads(id, clientCreationTIme) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Observer<List<ClientPayload>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_update_list); } @Override public void onNext(List<ClientPayload> clientPayloads) { getMvpView().showProgressbar(false); getMvpView().showPayloadDeletedAndUpdatePayloads(clientPayloads); } })); } }
SyncClientPayloadsPresenter extends BasePresenter<SyncClientPayloadsMvpView> { public void deleteAndUpdateClientPayload(int id, long clientCreationTIme) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerClient.deleteAndUpdatePayloads(id, clientCreationTIme) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Observer<List<ClientPayload>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_update_list); } @Override public void onNext(List<ClientPayload> clientPayloads) { getMvpView().showProgressbar(false); getMvpView().showPayloadDeletedAndUpdatePayloads(clientPayloads); } })); } @Inject  SyncClientPayloadsPresenter(DataManagerClient dataManagerClient); }
SyncClientPayloadsPresenter extends BasePresenter<SyncClientPayloadsMvpView> { public void deleteAndUpdateClientPayload(int id, long clientCreationTIme) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerClient.deleteAndUpdatePayloads(id, clientCreationTIme) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Observer<List<ClientPayload>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_update_list); } @Override public void onNext(List<ClientPayload> clientPayloads) { getMvpView().showProgressbar(false); getMvpView().showPayloadDeletedAndUpdatePayloads(clientPayloads); } })); } @Inject  SyncClientPayloadsPresenter(DataManagerClient dataManagerClient); @Override void attachView(SyncClientPayloadsMvpView mvpView); @Override void detachView(); void loadDatabaseClientPayload(); void syncClientPayload(ClientPayload clientPayload); void deleteAndUpdateClientPayload(int id, long clientCreationTIme); void updateClientPayload(ClientPayload clientPayload); }
SyncClientPayloadsPresenter extends BasePresenter<SyncClientPayloadsMvpView> { public void deleteAndUpdateClientPayload(int id, long clientCreationTIme) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerClient.deleteAndUpdatePayloads(id, clientCreationTIme) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Observer<List<ClientPayload>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(R.string.failed_to_update_list); } @Override public void onNext(List<ClientPayload> clientPayloads) { getMvpView().showProgressbar(false); getMvpView().showPayloadDeletedAndUpdatePayloads(clientPayloads); } })); } @Inject  SyncClientPayloadsPresenter(DataManagerClient dataManagerClient); @Override void attachView(SyncClientPayloadsMvpView mvpView); @Override void detachView(); void loadDatabaseClientPayload(); void syncClientPayload(ClientPayload clientPayload); void deleteAndUpdateClientPayload(int id, long clientCreationTIme); void updateClientPayload(ClientPayload clientPayload);  }