### Question:
LogoutServlet extends HttpServlet { protected String createRedirectUrl(final HttpServletRequestAccessor request, final long tenantId) throws ServletException { final String redirectUrlFromRequest = request.getRedirectUrl(); String redirectUrl = redirectUrlFromRequest != null ? redirectUrlFromRequest : getDefaultRedirectUrl(tenantId); return new RedirectUrlBuilder(redirectUrl).build().getUrl(); }    }### Answer:
@Test public void testCreateRedirectUrlWithDefaultRedirect() throws Exception { doReturn(null).when(requestAccessor).getRedirectUrl(); String redirectURL = logoutServlet.createRedirectUrl(requestAccessor, 1L); assertThat(redirectURL).isEqualTo(AuthenticationManager.DEFAULT_DIRECT_URL); }
@Test public void testCreateRedirectUrlWithDefaultRedirectAndNonDefaultTenant() throws Exception { doReturn(null).when(requestAccessor).getRedirectUrl(); String redirectURL = logoutServlet.createRedirectUrl(requestAccessor, 3L); assertThat(redirectURL).isEqualTo(AuthenticationManager.DEFAULT_DIRECT_URL + "?tenant=3"); }
@Test public void testCreateRedirectUrl() throws Exception { doReturn("redirectURL").when(requestAccessor).getRedirectUrl(); String redirectURL = logoutServlet.createRedirectUrl(requestAccessor, 1L); assertThat(redirectURL).isEqualTo("redirectURL"); }