コード例 #1
0
  @Test
  public void shouldCreateCoverageLineItemWhenTargetGroupProductIsNull() {
    FacilityVisit facilityVisit = new FacilityVisit();
    facilityVisit.setId(1L);
    Facility facility = mock(Facility.class);

    CoverageLineItem coverageLineItem = new CoverageLineItem(facilityVisit, facility, null);

    assertThat(coverageLineItem.getFacilityVisitId(), is(facilityVisit.getId()));
    assertThat(coverageLineItem.getTargetGroup(), is(nullValue()));
  }
コード例 #2
0
  @Test
  public void shouldCreateCoverageLineItemWhenTargetGroupProductIsNotNull() {
    FacilityVisit facilityVisit = new FacilityVisit();
    facilityVisit.setId(1L);
    Facility facility = mock(Facility.class);
    when(facility.getCatchmentPopulation()).thenReturn(100L);
    String productCode = "P10";
    TargetGroupProduct targetGroupProduct = new TargetGroupProduct("BCG", productCode, true);
    when(facility.getWhoRatioFor(productCode)).thenReturn(67D);

    CoverageLineItem coverageLineItem =
        new CoverageLineItem(facilityVisit, facility, targetGroupProduct);

    assertThat(coverageLineItem.getFacilityVisitId(), is(facilityVisit.getId()));
    assertThat(coverageLineItem.getTargetGroup(), is(67));
  }