@Test public void shouldShowErrorMSGWhenThereWasARequisitionInTheSamePeriod() throws Exception { when(mockRnrFormRepository.isPeriodUnique(any(RnRForm.class))).thenReturn(false); when(VIARequisitionFragment.validateConsultationNumber()).thenReturn(true); presenter.rnRForm = createRnrForm(RnRForm.Emergency.No); presenter.processRequisition("123"); Assert.assertEquals(LMISTestApp.getContext().getResources().getString(R.string.msg_requisition_not_unique), ShadowToast.getTextOfLatestToast()); }
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);  }