### Question:
RequestDataConverter { public static Map<Double, List<String>> buildRatioCityCodeRegionMap(List<String> iplCityCodes) { Map<String, Double> regionRatioMap = new HashMap<>(); for (String ipCityCode : iplCityCodes) { Double ratio = getRegionRatioByCityCode(ipCityCode); String region = getRegionByCityCode(ipCityCode); if (regionRatioMap.containsKey(region)) { regionRatioMap.put(region, regionRatioMap.get(region) + ratio); } else { regionRatioMap.put(region, ratio); } } Map<Double, List<String>> ratioCityCodeRegionMap = new HashMap<>(); for (Map.Entry<String, Double> entry : regionRatioMap.entrySet()) { if (ratioCityCodeRegionMap.containsKey(entry.getValue())) { ratioCityCodeRegionMap.get(entry.getValue()).add(entry.getKey()); } else { List<String> regionList = new ArrayList(); regionList.add(entry.getKey()); ratioCityCodeRegionMap.put(entry.getValue(), regionList); } } return ratioCityCodeRegionMap; } 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 buildRatioCityCodeRegionMap() { List<String> list = new ArrayList(); list.add("1156511600"); list.add("1156511700"); list.add("1156230700"); list.add("1156430900"); Map res = RequestDataConverter.buildRatioCityCodeRegionMap(list); Map exp = new HashMap(); List expRes1 = (List) DEF_CODE_REGION_RATIO_MAP.get("1156511600"); List expRes2 = (List) DEF_CODE_REGION_RATIO_MAP.get("1156511700"); List expRes3 = (List) DEF_CODE_REGION_RATIO_MAP.get("1156230700"); List expRes4 = (List) DEF_CODE_REGION_RATIO_MAP.get("1156430900"); List<String> oneL = new ArrayList(), twoL = new ArrayList(); oneL.add(String.valueOf(expRes3.get(0))); oneL.add(String.valueOf(expRes4.get(0))); exp.put(1D, oneL); Double sum = (Double) expRes1.get(1) + (Double) expRes2.get(1); twoL.add(String.valueOf(expRes1.get(0))); exp.put(sum, twoL); assertTrue(res.equals(exp)); }