@Test public void shouldReturnWhoCode() throws Exception { String productCode = "BCG"; FacilityProgramProduct facilityProgramProduct = new FacilityProgramProduct(); Product product = mock(Product.class); when(product.getCode()).thenReturn(productCode); facilityProgramProduct.setProduct(product); ProgramProductISA programProductISA = mock(ProgramProductISA.class); when(programProductISA.getWhoRatio()).thenReturn(1234D); facilityProgramProduct.setProgramProductIsa(programProductISA); assertThat(facilityProgramProduct.getWhoRatio(), is(1234D)); }
@JsonIgnore public Double getWhoRatio() { if(this.overriddenIsa != null) return overriddenIsa.getWhoRatio(); else if(this.programProductIsa != null) return programProductIsa.getWhoRatio(); else return null; }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public Double getWhoRatio() { if(this.overriddenIsa != null) return overriddenIsa.getWhoRatio(); else if(this.programProductIsa != null) return programProductIsa.getWhoRatio(); else return null; } }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public Double getWhoRatio() { if(this.overriddenIsa != null) return overriddenIsa.getWhoRatio(); else if(this.programProductIsa != null) return programProductIsa.getWhoRatio(); else return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public Double getWhoRatio() { if(this.overriddenIsa != null) return overriddenIsa.getWhoRatio(); else if(this.programProductIsa != null) return programProductIsa.getWhoRatio(); else return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); @JsonIgnore ProductGroup getActiveProductGroup(); Integer calculateIsa(Long population, Integer numberOfMonthsInPeriod); Integer calculateIsaByPackSize(Long population, Integer numberOfMonthsInPeriod); @JsonIgnore Double getWhoRatio(); static List<FacilityProgramProduct> filterActiveProducts(List<FacilityProgramProduct> programProducts); }
FacilityProgramProduct extends ProgramProduct { @JsonIgnore public Double getWhoRatio() { if(this.overriddenIsa != null) return overriddenIsa.getWhoRatio(); else if(this.programProductIsa != null) return programProductIsa.getWhoRatio(); else return null; } FacilityProgramProduct(ProgramProduct programProduct, Long facilityId);  FacilityProgramProduct(ProgramProduct programProduct, Long facilityId, ISA isa); @JsonIgnore ProductGroup getActiveProductGroup(); Integer calculateIsa(Long population, Integer numberOfMonthsInPeriod); Integer calculateIsaByPackSize(Long population, Integer numberOfMonthsInPeriod); @JsonIgnore Double getWhoRatio(); static List<FacilityProgramProduct> filterActiveProducts(List<FacilityProgramProduct> programProducts);  }