コード例 #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
  @Test
  public void shouldMapToIVRWebResponse() {
    SubscriptionDetailsResponse detailsResponse =
        new SubscriptionDetailsResponse(
            UUID.randomUUID().toString(),
            SubscriptionPack.BARI_KILKARI,
            SubscriptionStatus.ACTIVE,
            "WEEK13",
            null,
            DateTime.now());
    ArrayList<SubscriptionDetailsResponse> responseList = new ArrayList<>();
    responseList.add(detailsResponse);

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

    SubscriptionIVRWebResponse ivrWebResponse = (SubscriptionIVRWebResponse) webResponse;
    assertEquals(1, ivrWebResponse.getSubscriptionDetails().size());
    SubscriptionDetails subscriptionDetails = ivrWebResponse.getSubscriptionDetails().get(0);
    assertEquals(detailsResponse.getSubscriptionId(), subscriptionDetails.getSubscriptionId());
    assertEquals(detailsResponse.getPack().name(), subscriptionDetails.getPack());
    assertEquals(detailsResponse.getStatus().getDisplayString(), subscriptionDetails.getStatus());
    assertEquals(detailsResponse.getCampaignId(), subscriptionDetails.getLastCampaignId());
  }