@Test public void shouldReturnTrueWhenHasExist() throws Exception { Regimen regimen = new Regimen(); regimen.setId(100L); regimen.setType(Regimen.RegimeType.Adults); regimen.setName("test"); RegimenItem regimenItem = new RegimenItem(); regimenItem.setRegimen(regimen); presenter.getRnRForm().getRegimenItemListWrapper().add(regimenItem); assertTrue(presenter.isRegimeItemExists(regimen)); }
public boolean isRegimeItemExists(Regimen regimen) { for (RegimenItem item : rnRForm.getRegimenItemListWrapper()) { Regimen itemRegimen = item.getRegimen(); if (equalRegimen(regimen, itemRegimen)) { return true; } } return false; }
MMIARequisitionPresenter extends BaseRequisitionPresenter { public boolean isRegimeItemExists(Regimen regimen) { for (RegimenItem item : rnRForm.getRegimenItemListWrapper()) { Regimen itemRegimen = item.getRegimen(); if (equalRegimen(regimen, itemRegimen)) { return true; } } return false; } }
MMIARequisitionPresenter extends BaseRequisitionPresenter { public boolean isRegimeItemExists(Regimen regimen) { for (RegimenItem item : rnRForm.getRegimenItemListWrapper()) { Regimen itemRegimen = item.getRegimen(); if (equalRegimen(regimen, itemRegimen)) { return true; } } return false; }  }
MMIARequisitionPresenter extends BaseRequisitionPresenter { public boolean isRegimeItemExists(Regimen regimen) { for (RegimenItem item : rnRForm.getRegimenItemListWrapper()) { Regimen itemRegimen = item.getRegimen(); if (equalRegimen(regimen, itemRegimen)) { return true; } } return false; }  @Override void attachView(BaseView baseView); @Override void loadData(final long formId, Date periodEndDate); @Override void updateUIAfterSubmit(); @Override void updateFormUI(); void setViewModels(List<RnrFormItem> formItems,
                              List<RegimenItem> regimenItemList,
                              List<BaseInfoItem> baseInfoItemList,
                              List<RegimenItemThreeLines> regimenItemthreeList,
                              String comments); void setComments(String comments); Observable<Void> addCustomRegimenItem(final Regimen regimen); boolean isRegimeItemExists(Regimen regimen); Observable<Void> deleteRegimeItem(final RegimenItem item); Observable<Void> getSaveFormObservable(final List<RnrFormItem> rnrFormItems,
                                                  final List<RegimenItem> regimenItems,
                                                  final List<BaseInfoItem> baseInfoItems,
                                                  final List<RegimenItemThreeLines> threeLineItems,
                                                  final String comment); }
MMIARequisitionPresenter extends BaseRequisitionPresenter { public boolean isRegimeItemExists(Regimen regimen) { for (RegimenItem item : rnRForm.getRegimenItemListWrapper()) { Regimen itemRegimen = item.getRegimen(); if (equalRegimen(regimen, itemRegimen)) { return true; } } return false; }  @Override void attachView(BaseView baseView); @Override void loadData(final long formId, Date periodEndDate); @Override void updateUIAfterSubmit(); @Override void updateFormUI(); void setViewModels(List<RnrFormItem> formItems,
                              List<RegimenItem> regimenItemList,
                              List<BaseInfoItem> baseInfoItemList,
                              List<RegimenItemThreeLines> regimenItemthreeList,
                              String comments); void setComments(String comments); Observable<Void> addCustomRegimenItem(final Regimen regimen); boolean isRegimeItemExists(Regimen regimen); Observable<Void> deleteRegimeItem(final RegimenItem item); Observable<Void> getSaveFormObservable(final List<RnrFormItem> rnrFormItems,
                                                  final List<RegimenItem> regimenItems,
                                                  final List<BaseInfoItem> baseInfoItems,
                                                  final List<RegimenItemThreeLines> threeLineItems,
                                                  final String comment);  }