### Question:
RequestDataConverter { public static Map<String, Double> getRegionRatioMap(TargetingChannel targetingChannel) { Map<String, Double> regionRatioMap = new HashMap<>(); if (!CommonUtil.isEmpty(targetingChannel.getIplCityCodes())) { for (String iplCityCode : targetingChannel.getIplCityCodes()) { Double ratio = getRegionRatioByCityCode(iplCityCode); String region = getRegionByCityCode(iplCityCode); regionRatioMap.put(region, ratio); } } else if (!CommonUtil.isEmpty(targetingChannel.getResidenceCityNames())) { for (String residenceCityName : targetingChannel.getResidenceCityNames()) { String cityCode = getCityCodeByCityName(residenceCityName); Double ratio = getRegionRatioByCityCode(cityCode); String region = getRegionByCityCode(cityCode); regionRatioMap.put(region, ratio); } } return regionRatioMap; } private  RequestDataConverter(); static String getRegionByCityCode(String cityCode); static String getRegionByCityName(String cityName); static String getCityCodeByCityName(String cityName); static Double getRegionRatioByCityCode(String cityCode); static Map<String, Double> getRegionRatioMap(TargetingChannel targetingChannel); static double getHourDayRatio(List<Integer> listOfHours); static Map<Double, List<String>> buildRatioCityCodeRegionMap(List<String> iplCityCodes); static Map<Double, List<String>> buildRatioResidenceRegionMap(List<String> residenceCityNames);  }### Answer:
@Test public void getRegionRatioMap() { TargetingChannel tc = new TargetingChannel(); tc.setIplCityCodes(Arrays.asList("1156510600")); Map res = RequestDataConverter.getRegionRatioMap(tc); List expRes = (List) DEF_CODE_REGION_RATIO_MAP.get("1156510600"); Map exp = new HashMap(); exp.put(String.valueOf(expRes.get(0)), (Double) expRes.get(1)); assertTrue(res.equals(exp)); tc = new TargetingChannel(); tc.setIplCityCodes(Arrays.asList("123")); res = RequestDataConverter.getRegionRatioMap(tc); exp = new HashMap(); exp.put("", 0.0); assertTrue(res.equals(exp)); tc = new TargetingChannel(); tc.setResidenceCityNames(Arrays.asList("city13")); res = RequestDataConverter.getRegionRatioMap(tc); expRes = (List) DEF_CODE_REGION_RATIO_MAP.get("1156430900"); exp = new HashMap(); exp.put(String.valueOf(expRes.get(0)), (Double) expRes.get(1)); assertTrue(res.equals(exp)); }