JsonObjectUtils { public static JsonObject multiMapToJsonObject(MultiMap map) { JsonObject mapJsonObject = new JsonObject(); if (map == null) { return mapJsonObject; } for (Map.Entry<String, String> entry : map) { mapJsonObject.put(entry.getKey(), entry.getValue()); } return mapJsonObject; } private  JsonObjectUtils(); static JsonObject multiMapToJsonObject(MultiMap map); static MultiMap jsonObjectToMultiMap(JsonObject jsonObject);  }
@Test public void testMultiMapToJsonObject(TestContext context) { JsonObject converted = JsonObjectUtils.multiMapToJsonObject(null); context.assertEquals(new JsonObject(), converted); CaseInsensitiveHeaders map = new CaseInsensitiveHeaders(); JsonObject expected = new JsonObject(); context.assertEquals(expected, JsonObjectUtils.multiMapToJsonObject(map)); map.add("key_1", "value_1"); map.add("key_2", "value_2"); expected.put("key_1", "value_1").put("key_2", "value_2"); context.assertEquals(expected, JsonObjectUtils.multiMapToJsonObject(map)); }