public static MultivaluedHashMap<String, String> getQueryParams(Map<String, String[]> parameterMap) {
        MultivaluedHashMap<String, String> queryParameters = new MultivaluedHashMap<>();

        if (parameterMap.size() == 0) {
            return queryParameters;
        }

        for (Map.Entry<String, String[]> parameter : parameterMap.entrySet()) {
            for (String value : parameter.getValue()) {
                try {
                    queryParameters.add(URLDecoder.decode(parameter.getKey(), StandardCharsets.UTF_8.name()),
                            URLDecoder.decode(value, StandardCharsets.UTF_8.name()));
                } catch (UnsupportedEncodingException e) {
                    LOGGER.error("Unable to decode query parameter", e);
                }
            }
        }
        return queryParameters;
    }
@Test(description = "convert query parameters to multivaluedmap with decoded values")
    public void convertWithDecodedValues() throws Exception {

        Map<String, String[]> params = new HashMap<>();
        params.put(URLEncoder.encode("key1&", UTF_8.name()), new String[]{"value1", URLEncoder.encode("value2?", UTF_8.name())});
        params.put("key2", new String[]{URLEncoder.encode("value2", UTF_8.name()), "value3", "value4", "value4"});
        assertThat(params, IsMapContaining.hasEntry("key1%26", new String[]{"value1", "value2%3F"}));

        MultivaluedHashMap<String, String> multivaluedHashMap = ServletUtils.getQueryParams(params);
        assertEquals(multivaluedHashMap.size(), 2);
        assertThat(multivaluedHashMap, IsMapContaining.hasKey("key1&"));
        assertEquals(multivaluedHashMap.get("key1&").size(), 2);
        assertEquals(multivaluedHashMap.get("key1&"), Arrays.asList("value1", "value2?"));
        assertEquals(multivaluedHashMap.get("key2"), Arrays.asList("value2", "value3", "value4", "value4"));
    }