@Test public void shouldDeleteNewRnrFormItem() throws Exception { Product product = new Product(); RnrFormItem rnrFormItem = new RnrFormItemBuilder().setProduct(product).setRequestAmount(100L).build(); TestSubscriber<Void> testSubscriber = new TestSubscriber<>(); presenter.removeRnrItem(rnrFormItem).subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoErrors(); verify(mockRnrFormItemRepository).deleteRnrItem(rnrFormItem); }
public Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem) { return Observable.create((Observable.OnSubscribe<Void>) subscriber -> { try { rnrFormItemRepository.deleteRnrItem(rnrFormItem); } catch (LMISException e) { new LMISException(e, "VIARequisitionPresenter.removeRnrItem").reportToFabric(); subscriber.onError(e); } subscriber.onCompleted(); }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); }
VIARequisitionPresenter extends BaseRequisitionPresenter { public Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem) { return Observable.create((Observable.OnSubscribe<Void>) subscriber -> { try { rnrFormItemRepository.deleteRnrItem(rnrFormItem); } catch (LMISException e) { new LMISException(e, "VIARequisitionPresenter.removeRnrItem").reportToFabric(); subscriber.onError(e); } subscriber.onCompleted(); }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); } }
VIARequisitionPresenter extends BaseRequisitionPresenter { public Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem) { return Observable.create((Observable.OnSubscribe<Void>) subscriber -> { try { rnrFormItemRepository.deleteRnrItem(rnrFormItem); } catch (LMISException e) { new LMISException(e, "VIARequisitionPresenter.removeRnrItem").reportToFabric(); subscriber.onError(e); } subscriber.onCompleted(); }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); } VIARequisitionPresenter(); }
VIARequisitionPresenter extends BaseRequisitionPresenter { public Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem) { return Observable.create((Observable.OnSubscribe<Void>) subscriber -> { try { rnrFormItemRepository.deleteRnrItem(rnrFormItem); } catch (LMISException e) { new LMISException(e, "VIARequisitionPresenter.removeRnrItem").reportToFabric(); subscriber.onError(e); } subscriber.onCompleted(); }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); } VIARequisitionPresenter(); @Override void loadData(long formId, Date periodEndDate); void loadEmergencyData(final List<StockCard> stockCards, final Date periodEndDate); @Override void attachView(BaseView baseView); void populateAdditionalDrugsViewModels(List<RnrFormItem> addedDrugInVIAs, Date periodBegin); void deleteRnRItemFromViewModel(final RnrFormItem rnrFormItem); @Override void updateUIAfterSubmit(); @Override void updateFormUI(); @Override void submitRequisition(); boolean processRequisition(String consultationNumbers); Observable<RnRForm> getSaveFormObservable(final String consultationNumbers); String getConsultationNumbers(); void setConsultationNumbers(String consultationNumbers); void createStockCardsOrUnarchiveAndAddToFormForAdditionalRnrItems(); Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem); }
VIARequisitionPresenter extends BaseRequisitionPresenter { public Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem) { return Observable.create((Observable.OnSubscribe<Void>) subscriber -> { try { rnrFormItemRepository.deleteRnrItem(rnrFormItem); } catch (LMISException e) { new LMISException(e, "VIARequisitionPresenter.removeRnrItem").reportToFabric(); subscriber.onError(e); } subscriber.onCompleted(); }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()); } VIARequisitionPresenter(); @Override void loadData(long formId, Date periodEndDate); void loadEmergencyData(final List<StockCard> stockCards, final Date periodEndDate); @Override void attachView(BaseView baseView); void populateAdditionalDrugsViewModels(List<RnrFormItem> addedDrugInVIAs, Date periodBegin); void deleteRnRItemFromViewModel(final RnrFormItem rnrFormItem); @Override void updateUIAfterSubmit(); @Override void updateFormUI(); @Override void submitRequisition(); boolean processRequisition(String consultationNumbers); Observable<RnRForm> getSaveFormObservable(final String consultationNumbers); String getConsultationNumbers(); void setConsultationNumbers(String consultationNumbers); void createStockCardsOrUnarchiveAndAddToFormForAdditionalRnrItems(); Observable<Void> removeRnrItem(final RnrFormItem rnrFormItem);  }