@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()); }
@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()); }
@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()); }