VIARequisitionPresenter extends BaseRequisitionPresenter { protected boolean validateRnrFormItems() { for (int i = 0; i < requisitionFormItemViewModels.size(); i++) { RequisitionFormItemViewModel itemViewModel = requisitionFormItemViewModels.get(i); if (TextUtils.isEmpty(itemViewModel.getRequestAmount()) || TextUtils.isEmpty(itemViewModel.getApprovedAmount())) { view.showListInputError(i); return false; } } 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);  }
@Test public void shouldReturnFalseWhenRequestAmountIsNull() throws Exception { List<RequisitionFormItemViewModel> list = new ArrayList<>(); for (int i = 0; i < 3; i++) { list.add(new RequisitionFormItemViewModel(createRnrFormItem(i))); list.get(i).setRequestAmount(""); } presenter.requisitionFormItemViewModels = list; assertFalse(presenter.validateRnrFormItems()); verify(VIARequisitionFragment).showListInputError(anyInt()); }