### Question:
InitFilter implements Filter { private String getAbsoluteUrl(HttpServletRequest request) { return getAbsoluteUrl(request.isSecure(), request.getServerName(), request.getContextPath(), request.getRequestURI(), request.getRequestURL().toString()); }  void doFilter(ServletRequest req, ServletResponse res,
            FilterChain chain); @Override void init(FilterConfig filterConfig); @Override void destroy();  }### Answer:
@Test public void testGetAbsoluteUrlOnRootWithHttp() throws Exception { boolean secure = false; String contextPath = ""; String requestURI = "/"; String requestURL = "http: String absoluteUrl = InitFilter.getAbsoluteUrl(secure, SERVER_NAME, contextPath, requestURI, requestURL); assertEquals("http: }
@Test public void testGetAbsoluteUrlOnRootWithHttps() throws Exception { boolean secure = true; String contextPath = ""; String requestURI = "/"; String requestURL = "https: String absoluteUrl = InitFilter.getAbsoluteUrl(secure, SERVER_NAME, contextPath, requestURI, requestURL); assertEquals("http: }
@Test public void testGetAbsoluteUrlAgainstTop() throws Exception { boolean secure = false; String contextPath = "/roller"; String requestURI = "/roller/"; String requestURL = "http: String absoluteUrl = InitFilter.getAbsoluteUrl(secure, SERVER_NAME, contextPath, requestURI, requestURL); assertEquals("http: }
@Test public void testGetAbsoluteUrlAgainstPermalink() throws Exception { boolean secure = false; String contextPath = "/roller"; String requestURI = "/roller/handle/entry/title"; String requestURL = "http: String absoluteUrl = InitFilter.getAbsoluteUrl(secure, SERVER_NAME, contextPath, requestURI, requestURL); assertEquals("http: }