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