### Question:
RequestUtils { public static MultiValueMap<String, String> getQueryStringParameters(HttpServletRequest request) { String queryString = request.getQueryString(); return (StringUtils.isEmpty(queryString)) ? null : UriComponentsBuilder.newInstance().query(queryString).build().getQueryParams(); }  static String getRemoteAddress(HttpServletRequest request); static String getRemoteAddress(); static void logRequestHeadersAndQueryParams(HttpServletRequest request, Logger logger); static MultiValueMap<String, String> getQueryStringParameters(HttpServletRequest request); static List<String> getQueryStringParameterValues(HttpServletRequest request, String parameterName); static String getQueryStringParameterValue(HttpServletRequest request, String parameterName);  }### Answer:
@Test public void testGetQueryStringParameters() { HttpServletRequest request = createMock(HttpServletRequest.class); expect(request.getQueryString()).andReturn(null).once(); expect(request.getQueryString()).andReturn("").once(); expect(request.getQueryString()).andReturn("p1=1").once(); expect(request.getQueryString()).andReturn("p1=1&p2=2").once(); expect(request.getQueryString()).andReturn("p1=1a&p2=2&p1=1b").once(); replayAll(); Assert.assertNull(RequestUtils.getQueryStringParameters(request)); Assert.assertNull(RequestUtils.getQueryStringParameters(request)); MultiValueMap<String, String> parameters; parameters = RequestUtils.getQueryStringParameters(request); Assert.assertNotNull(parameters); Assert.assertEquals(1, parameters.size()); Assert.assertNotNull(parameters.get("p1")); Assert.assertEquals(1, parameters.get("p1").size()); Assert.assertEquals("1", parameters.get("p1").get(0)); parameters = RequestUtils.getQueryStringParameters(request); Assert.assertNotNull(parameters); Assert.assertEquals(2, parameters.size()); Assert.assertNotNull(parameters.get("p1")); Assert.assertEquals(1, parameters.get("p1").size()); Assert.assertEquals("1", parameters.get("p1").get(0)); Assert.assertNotNull(parameters.get("p2")); Assert.assertEquals(1, parameters.get("p2").size()); Assert.assertEquals("2", parameters.get("p2").get(0)); parameters = RequestUtils.getQueryStringParameters(request); Assert.assertNotNull(parameters); Assert.assertEquals(2, parameters.size()); Assert.assertNotNull(parameters.get("p1")); Assert.assertEquals(2, parameters.get("p1").size()); Assert.assertEquals("1a", parameters.get("p1").get(0)); Assert.assertEquals("1b", parameters.get("p1").get(1)); Assert.assertNotNull(parameters.get("p2")); Assert.assertEquals(1, parameters.get("p2").size()); Assert.assertEquals("2", parameters.get("p2").get(0)); verifyAll(); }