@Test(expected = NumberFormatException.class) public void testNumberFormatException() { RnRForm rnRForm = new RnRForm(); rnRForm.setBaseInfoItemListWrapper(newArrayList(new BaseInfoItem())); presenter.rnRForm = rnRForm; List<RequisitionFormItemViewModel> list = new ArrayList<>(); for (int i = 0; i < 3; i++) { list.add(new RequisitionFormItemViewModel(createRnrFormItem(i))); list.get(i).setRequestAmount(String.valueOf(i)); list.get(i).setAdjustedTotalRequest(String.valueOf(i)); } ViaKitsViewModel viaKitsViewModel = buildDefaultViaKit(); presenter.setViaKitsViewModel(viaKitsViewModel); presenter.requisitionFormItemViewModels = list; when(mockRnrFormRepository.isPeriodUnique(any(RnRForm.class))).thenReturn(true); when(VIARequisitionFragment.validateConsultationNumber()).thenReturn(true); presenter.processRequisition("avd"); }
public boolean processRequisition(String consultationNumbers) { if (!validateForm()) { return false; } if (!validateFormPeriod()) { ToastUtil.show(R.string.msg_requisition_not_unique); return false; } dataViewToModel(consultationNumbers); return true; }
VIARequisitionPresenter extends BaseRequisitionPresenter { public boolean processRequisition(String consultationNumbers) { if (!validateForm()) { return false; } if (!validateFormPeriod()) { ToastUtil.show(R.string.msg_requisition_not_unique); return false; } dataViewToModel(consultationNumbers); return true; } }
VIARequisitionPresenter extends BaseRequisitionPresenter { public boolean processRequisition(String consultationNumbers) { if (!validateForm()) { return false; } if (!validateFormPeriod()) { ToastUtil.show(R.string.msg_requisition_not_unique); return false; } dataViewToModel(consultationNumbers); return true; } VIARequisitionPresenter(); }
VIARequisitionPresenter extends BaseRequisitionPresenter { public boolean processRequisition(String consultationNumbers) { if (!validateForm()) { return false; } if (!validateFormPeriod()) { ToastUtil.show(R.string.msg_requisition_not_unique); return false; } dataViewToModel(consultationNumbers); return true; } 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 boolean processRequisition(String consultationNumbers) { if (!validateForm()) { return false; } if (!validateFormPeriod()) { ToastUtil.show(R.string.msg_requisition_not_unique); return false; } dataViewToModel(consultationNumbers); return true; } 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);  }