コード例 #1
0
  @Test
  public void shouldMapToCCWebResponseWithoutLocation() {
    SubscriptionDetailsResponse detailsResponse = setupData(null);
    ArrayList<SubscriptionDetailsResponse> responseList = new ArrayList<>();
    responseList.add(detailsResponse);

    SubscriptionBaseWebResponse webResponse =
        SubscriptionDetailsMapper.mapFrom(responseList, Channel.CONTACT_CENTER);

    SubscriptionCCWebResponse ccWebResponse = (SubscriptionCCWebResponse) webResponse;
    assertEquals(1, ccWebResponse.getSubscriptionDetails().size());
    AllSubscriptionDetails subscriptionDetails = ccWebResponse.getSubscriptionDetails().get(0);
    assertDetails(detailsResponse, subscriptionDetails);
    assertNull(subscriptionDetails.getLocation());
  }
コード例 #2
0
  @Test
  public void shouldMapToCCWebResponseWithLocation() {
    Location actualLocation = new Location("s", "d", "b", "p");
    SubscriptionDetailsResponse detailsResponse = setupData(actualLocation);
    ArrayList<SubscriptionDetailsResponse> responseList = new ArrayList<>();
    responseList.add(detailsResponse);

    SubscriptionBaseWebResponse webResponse =
        SubscriptionDetailsMapper.mapFrom(responseList, Channel.CONTACT_CENTER);

    SubscriptionCCWebResponse ccWebResponse = (SubscriptionCCWebResponse) webResponse;
    assertEquals(1, ccWebResponse.getSubscriptionDetails().size());
    AllSubscriptionDetails subscriptionDetails = ccWebResponse.getSubscriptionDetails().get(0);
    assertDetails(detailsResponse, subscriptionDetails);
    assertEquals(actualLocation.getDistrict(), subscriptionDetails.getLocation().getDistrict());
    assertEquals(actualLocation.getBlock(), subscriptionDetails.getLocation().getBlock());
    assertEquals(actualLocation.getPanchayat(), subscriptionDetails.getLocation().getPanchayat());
  }
コード例 #3
0
 private void assertDetails(
     SubscriptionDetailsResponse detailsResponse, AllSubscriptionDetails subscriptionDetails) {
   assertEquals(detailsResponse.getSubscriptionId(), subscriptionDetails.getSubscriptionId());
   assertEquals(detailsResponse.getPack().name(), subscriptionDetails.getPack());
   assertEquals(detailsResponse.getStatus().getDisplayString(), subscriptionDetails.getStatus());
   assertEquals(detailsResponse.getCampaignId(), subscriptionDetails.getLastCampaignId());
   assertEquals(detailsResponse.getBeneficiaryName(), subscriptionDetails.getBeneficiaryName());
   assertEquals(detailsResponse.getBeneficiaryAge(), subscriptionDetails.getBeneficiaryAge());
   assertEquals(detailsResponse.getStartWeekNumber(), subscriptionDetails.getWeekNumber());
   assertEquals(detailsResponse.getDateOfBirth(), subscriptionDetails.getDateOfBirth());
   assertEquals(
       detailsResponse.getExpectedDateOfDelivery(),
       subscriptionDetails.getExpectedDateOfDelivery());
   assertEquals(
       detailsResponse.getLastWeeklyMessageScheduledDate(),
       subscriptionDetails.getLastWeeklyMessageScheduledDate());
   assertEquals(
       detailsResponse.getLastUpdatedTimeForSubscription(),
       subscriptionDetails.getLastUpdatedTimeForSubscription());
   assertEquals(
       detailsResponse.getLastUpdatedTimeForBeneficiary(),
       subscriptionDetails.getLastUpdatedTimeForBeneficiary());
 }