### Question:
HttpServletRequestUtils { public static String extractScheme(HttpServletRequest request) { Preconditions.checkNotNull(request); String scheme = request.getHeader("X-FORWARDED-PROTO"); if (scheme == null) { scheme = request.getScheme(); } return scheme; } 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(expected=NullPointerException.class) public void extractScheme_NULL() { HttpServletRequestUtils.extractScheme(null); }
@Test public void extractScheme_X_FORWARDED_PROTO() { when(request.getHeader("X-FORWARDED-PROTO")).thenReturn("https"); assertEquals("https", HttpServletRequestUtils.extractScheme(request)); }
@Test public void extractScheme_NO_X_FORWARDED_PROTO() { when(request.getHeader("X-FORWARDED-PROTO")).thenReturn(null); when(request.getScheme()).thenReturn("https"); assertEquals("https", HttpServletRequestUtils.extractScheme(request)); }