VIARequisitionPresenter extends BaseRequisitionPresenter { protected RnRForm initEmergencyRnr(List<StockCard> stockCards, Date periodEndDate) throws LMISException { return rnrFormRepository.initEmergencyRnrForm(periodEndDate, stockCards); } 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 shouldInitEmergencyRnr() throws Exception { ArrayList<StockCard> stockCards = newArrayList(); Date periodEndDate = new Date(); RnRForm rnRForm = new RnRForm(); when(mockRnrFormRepository.initEmergencyRnrForm(periodEndDate, stockCards)).thenReturn(rnRForm); ArrayList<RnrFormItem> rnrFormItems = new ArrayList<>(); when(mockRnrFormRepository.generateRnrFormItems(rnRForm, stockCards)).thenReturn(rnrFormItems); RnRForm rnRForm1 = presenter.initEmergencyRnr(stockCards, periodEndDate); org.junit.Assert.assertThat(rnRForm1.getRnrFormItemListWrapper(), Is.<List<RnrFormItem>>is(rnrFormItems)); verify(mockRnrFormRepository, never()).createRnRsWithItems(newArrayList(rnRForm)); }