### Question:
AppUtils { public String getLocalUrl(final HttpServletRequest request) { if (request.getQueryString() == null || request.getQueryString().isBlank()) { return request.getRequestURI(); } return request.getRequestURI() + "?" + request.getQueryString(); }  List<String> getModelErrors(final BindingResult bindingResult, final String... excludedFields); void setCurrentPage(final Model model, final String currentPage); @SuppressWarnings("unchecked") void addNotification(final RedirectAttributes redirectAttributes, final Notification notification); List<String> getUnexpectedErrorMessageAsList(); String getUnexpectedErrorMessage(); List<String> getMessages(final String... messageKeys); String getMessage(final String messageKey); String getReturnUrl(final String url, final String fallback); String getLocalUrl(final HttpServletRequest request);  }### Answer:
@Test public void test_getLocalUrl_nullQueryString() { when(httpServletRequest.getRequestURI()).thenReturn("/path"); final String result = appUtils.getLocalUrl(httpServletRequest); assertEquals("/path", result); }
@Test public void test_getLocalUrl_blankQueryString() { when(httpServletRequest.getRequestURI()).thenReturn("/path"); when(httpServletRequest.getQueryString()).thenReturn(" "); final String result = appUtils.getLocalUrl(httpServletRequest); assertEquals("/path", result); }
@Test public void test_getLocalUrl_withQueryString() { when(httpServletRequest.getRequestURI()).thenReturn("/path"); when(httpServletRequest.getQueryString()).thenReturn("param=true"); final String result = appUtils.getLocalUrl(httpServletRequest); assertEquals("/path?param=true", result); }