@Test public void shouldReturnListWithDeactivatedItemsWhenDeactivateProgramToggleOn() { Product activeSupportedProduct = new ProductBuilder().setCode("P1").setIsActive(true).build(); Product inactiveProduct = new ProductBuilder().setCode("P2").setIsActive(false).build(); Product unsupportedProduct = new ProductBuilder().setCode("P3").setIsActive(true).build(); RnrFormItem activeRnrProduct = new RnrFormItemBuilder().setProduct(activeSupportedProduct).build(); RnrFormItem inactiveRnrProduct = new RnrFormItemBuilder().setProduct(inactiveProduct).build(); RnrFormItem unsupportedRnrProduct = new RnrFormItemBuilder().setProduct(unsupportedProduct).build(); rnRForm.setRnrFormItemListWrapper(newArrayList(activeRnrProduct, inactiveRnrProduct, unsupportedRnrProduct)); List<RnrFormItem> rnrFormDeactivatedItemList = rnRForm.getDeactivatedAndUnsupportedProductItems(Arrays.asList("P1", "P2")); assertEquals(2, rnrFormDeactivatedItemList.size()); assertEquals(false, rnrFormDeactivatedItemList.get(0).getProduct().isActive()); }
public List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> !(rnrFormItem.getProduct().isActive() && supportedProductCodes.contains(rnrFormItem.getProduct().getCode()))).toList(); }
RnRForm extends BaseModel { public List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> !(rnrFormItem.getProduct().isActive() && supportedProductCodes.contains(rnrFormItem.getProduct().getCode()))).toList(); } }
RnRForm extends BaseModel { public List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> !(rnrFormItem.getProduct().isActive() && supportedProductCodes.contains(rnrFormItem.getProduct().getCode()))).toList(); }  }
RnRForm extends BaseModel { public List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> !(rnrFormItem.getProduct().isActive() && supportedProductCodes.contains(rnrFormItem.getProduct().getCode()))).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> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes) { return from(getRnrFormItemListWrapper()).filter(rnrFormItem -> !(rnrFormItem.getProduct().isActive() && supportedProductCodes.contains(rnrFormItem.getProduct().getCode()))).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);  }