DispatchCriteriaHelper { public static String buildFromPartsMap(Map<String, String> partsMap) { if (partsMap != null && !partsMap.isEmpty()) { Map<String, String> criteriaMap = new TreeMap<String, String>(); criteriaMap.putAll(partsMap); StringBuilder result = new StringBuilder(); for (String criteria : criteriaMap.keySet()) { result.append("/").append(criteria).append("=").append(criteriaMap.get(criteria)); } return result.toString(); } return ""; }  static String extractParamsFromURI(String uri); static String extractCommonPrefix(List<String> uris); static String extractCommonSuffix(List<String> uris); static String extractPartsFromURIs(List<String> uris); static String extractPartsFromURIPattern(String pattern); static String extractFromURIPattern(String pattern, String realURI); static String buildFromPartsMap(Map<String, String> partsMap); static String buildFromParamsMap(String paramsRule, Map<String, String> paramsMap); static String extractFromURIParams(String paramsRule, String uri);  }
@Test public void testBuildFromPartsMap() { Map<String, String> partsMap = new HashMap<>(); partsMap.put("year", "2018"); partsMap.put("month", "05"); String dispatchCriteria = DispatchCriteriaHelper.buildFromPartsMap(partsMap); assertEquals("/month=05/year=2018", dispatchCriteria); }