### Question:
HttpServletRequestUtils { public static String constructRequestBaseUrl(HttpServletRequest request) { StringBuilder path = new StringBuilder(); String scheme = extractScheme(request); int port = extractServerPort(request); path.append (scheme); path.append (": path.append (extractHost(request)); if (!isDefaultPort(scheme, port)) { path.append (':'); path.append (port); } return path.toString(); } private  HttpServletRequestUtils(); static String extractClientIp(HttpServletRequest request); static String extractScheme(HttpServletRequest request); static String extractHost(HttpServletRequest request); static int extractServerPort(HttpServletRequest request); static String constructRequestBaseUrl(HttpServletRequest request); static String constructRequestUrl(HttpServletRequest request); static String constructRequestUrlWithParameters(HttpServletRequest request); static boolean isDefaultPort(String scheme, int port);  }### Answer:
@Test public void constructRequestBaseUrl_NON_STANDARD_PORT() { when(request.getHeader("X-FORWARDED-PROTO")).thenReturn("https"); when(request.getHeader("X-FORWARDED-HOST")).thenReturn("saos.org.pl"); when(request.getIntHeader("X-FORWARDED-PORT")).thenReturn(773); assertEquals("https: }
@Test public void constructRequestBaseUrl_STANDARD_PORT() { when(request.getHeader("X-FORWARDED-PROTO")).thenReturn("https"); when(request.getHeader("X-FORWARDED-HOST")).thenReturn("saos.org.pl"); when(request.getIntHeader("X-FORWARDED-PORT")).thenReturn(443); assertEquals("https: }