@Test public void shouldGetNonKitFormItemAndKitFormItem() throws Exception { Product kitProduct = new ProductBuilder().setIsActive(true).setIsKit(true).setCode("kit").build(); Product product = new ProductBuilder().setIsActive(true).setIsKit(false).setCode("product").build(); RnrFormItem kitRnrProduct = new RnrFormItemBuilder().setProduct(kitProduct).build(); RnrFormItem rnrProduct = new RnrFormItemBuilder().setProduct(product).build(); rnRForm.setRnrFormItemListWrapper(newArrayList(rnrProduct, kitRnrProduct)); List<RnrFormItem> rnrNonKitItems = rnRForm.getRnrItems(IsKit.No); assertEquals(1, rnrNonKitItems.size()); assertFalse(rnrNonKitItems.get(0).getProduct().isKit()); List<RnrFormItem> rnrKitItems = rnRForm.getRnrItems(IsKit.Yes); assertEquals(1, rnrKitItems.size()); assertTrue(rnrKitItems.get(0).getProduct().isKit()); }
public List<RnrFormItem> getRnrItems(final Product.IsKit isKit) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> rnrFormItem.getProduct() != null).filter(rnrFormItem -> isKit.isKit() == rnrFormItem.getProduct().isKit()).toList(); }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrItems(final Product.IsKit isKit) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> rnrFormItem.getProduct() != null).filter(rnrFormItem -> isKit.isKit() == rnrFormItem.getProduct().isKit()).toList(); } }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrItems(final Product.IsKit isKit) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> rnrFormItem.getProduct() != null).filter(rnrFormItem -> isKit.isKit() == rnrFormItem.getProduct().isKit()).toList(); }  }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrItems(final Product.IsKit isKit) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> rnrFormItem.getProduct() != null).filter(rnrFormItem -> isKit.isKit() == rnrFormItem.getProduct().isKit()).toList(); }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature); }
RnRForm extends BaseModel { public List<RnrFormItem> getRnrItems(final Product.IsKit isKit) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> rnrFormItem.getProduct() != null).filter(rnrFormItem -> isKit.isKit() == rnrFormItem.getProduct().isKit()).toList(); }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature);  }