@Test public void shouldReturnPackSizeNullIfNoProductExistsWithProductCode() { String productCode = "BCG"; ProgramSupported programSupported = new ProgramSupported(); programSupported.setProgramProducts(Collections.<FacilityProgramProduct>emptyList()); assertThat(programSupported.getPackSizeFor(productCode), is(nullValue())); }
@JsonIgnore public Integer getPackSizeFor(final String productCode) { FacilityProgramProduct facilityProgramProduct = (FacilityProgramProduct) CollectionUtils.find(this.getProgramProducts(), new Predicate() { @Override public boolean evaluate(Object o) { return ((FacilityProgramProduct) o).getProduct().getCode().equals(productCode); } }); return (facilityProgramProduct == null) ? null : facilityProgramProduct.getProduct().getPackSize(); }
ProgramSupported extends BaseModel implements Importable { @JsonIgnore public Integer getPackSizeFor(final String productCode) { FacilityProgramProduct facilityProgramProduct = (FacilityProgramProduct) CollectionUtils.find(this.getProgramProducts(), new Predicate() { @Override public boolean evaluate(Object o) { return ((FacilityProgramProduct) o).getProduct().getCode().equals(productCode); } }); return (facilityProgramProduct == null) ? null : facilityProgramProduct.getProduct().getPackSize(); } }
ProgramSupported extends BaseModel implements Importable { @JsonIgnore public Integer getPackSizeFor(final String productCode) { FacilityProgramProduct facilityProgramProduct = (FacilityProgramProduct) CollectionUtils.find(this.getProgramProducts(), new Predicate() { @Override public boolean evaluate(Object o) { return ((FacilityProgramProduct) o).getProduct().getCode().equals(productCode); } }); return (facilityProgramProduct == null) ? null : facilityProgramProduct.getProduct().getPackSize(); } ProgramSupported(Long programId, Boolean active, Date startDate); }
ProgramSupported extends BaseModel implements Importable { @JsonIgnore public Integer getPackSizeFor(final String productCode) { FacilityProgramProduct facilityProgramProduct = (FacilityProgramProduct) CollectionUtils.find(this.getProgramProducts(), new Predicate() { @Override public boolean evaluate(Object o) { return ((FacilityProgramProduct) o).getProduct().getCode().equals(productCode); } }); return (facilityProgramProduct == null) ? null : facilityProgramProduct.getProduct().getPackSize(); } ProgramSupported(Long programId, Boolean active, Date startDate); void isValid(); @SuppressWarnings("unused") String getStringStartDate(); @JsonIgnore Double getWhoRatioFor(final String productCode); @JsonIgnore Integer getPackSizeFor(final String productCode); }
ProgramSupported extends BaseModel implements Importable { @JsonIgnore public Integer getPackSizeFor(final String productCode) { FacilityProgramProduct facilityProgramProduct = (FacilityProgramProduct) CollectionUtils.find(this.getProgramProducts(), new Predicate() { @Override public boolean evaluate(Object o) { return ((FacilityProgramProduct) o).getProduct().getCode().equals(productCode); } }); return (facilityProgramProduct == null) ? null : facilityProgramProduct.getProduct().getPackSize(); } ProgramSupported(Long programId, Boolean active, Date startDate); void isValid(); @SuppressWarnings("unused") String getStringStartDate(); @JsonIgnore Double getWhoRatioFor(final String productCode); @JsonIgnore Integer getPackSizeFor(final String productCode);  }