public static String buildFromPartsMap(String partsRule, Map<String, String> partsMap) {
      if (partsMap != null && !partsMap.isEmpty()) {
         Multimap<String, String> multimap = partsMap.entrySet().stream().collect(ArrayListMultimap::create,
               (m, e) -> m.put(e.getKey(), e.getValue()), Multimap::putAll);
         return buildFromPartsMap(partsRule, multimap);
      }
      return "";
   }
@Test
   void testBuildFromPartsMap() {
      Multimap<String, String> partsMap = ArrayListMultimap.create();
      partsMap.put("year", "2018");
      partsMap.put("month", "05");
      partsMap.put("year-summary", "true");
      partsMap.put("half-year", "true");

      // Dispatch string parts are sorted.
      String dispatchCriteria = DispatchCriteriaHelper.buildFromPartsMap("month && year", partsMap);
      assertEquals("/month=05/year=2018", dispatchCriteria);

      // Only 1 parameter should be taken into account according to rules.
      dispatchCriteria = DispatchCriteriaHelper.buildFromPartsMap("year", partsMap);
      assertEquals("/year=2018", dispatchCriteria);

      // 2 parameters should be taken into account according to rules with no inclusion of year.
      dispatchCriteria = DispatchCriteriaHelper.buildFromPartsMap("month && year-summary", partsMap);
      assertEquals("/month=05/year-summary=true", dispatchCriteria);
   }