### Question:
SLIAuthenticationEntryPoint implements AuthenticationEntryPoint { static boolean isSecureRequest(HttpServletRequest request) { String serverName = request.getServerName(); boolean isSecureEnvironment = (!serverName.substring(0, serverName.indexOf(".")).equals( NONSECURE_ENVIRONMENT_NAME)); return (request.isSecure() && isSecureEnvironment); }  void setCallbackUrl(String callbackUrl); String getCallbackUrl(); void setApiUrl(String apiUrl); String getApiUrl(); RESTClient getRestClient(); void setRestClient(RESTClient restClient); APIClient getApiClient(); void setApiClient(APIClient apiClient); PropertiesDecryptor getPropDecryptor(); void setPropDecryptor(PropertiesDecryptor propDecryptor); @Override void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException); static final String OAUTH_TOKEN; static final String DASHBOARD_COOKIE; }### Answer:
@Test public void testIsSecuredRequest() throws Exception { LOG.debug("[SLCAuthenticationEntryPointTest]Secure Protocol with local environment, return FALSE"); when(request.getServerName()).thenReturn("local.slidev.org"); when(request.isSecure()).thenReturn(true); assertFalse(SLIAuthenticationEntryPoint.isSecureRequest(request)); LOG.debug("[SLCAuthenticationEntryPointTest]Non-Secure Protocol with local environment, return FALSE"); when(request.getServerName()).thenReturn("local.slidev.org"); when(request.isSecure()).thenReturn(false); assertFalse(SLIAuthenticationEntryPoint.isSecureRequest(request)); LOG.debug("[SLCAuthenticationEntryPointTest]Non-Secure Protocol with non-local environment, return FALSE"); when(request.getServerName()).thenReturn("rcdashboard.slidev.org"); when(request.isSecure()).thenReturn(false); assertFalse(SLIAuthenticationEntryPoint.isSecureRequest(request)); LOG.debug("[SLCAuthenticationEntryPointTest]Non-Secure Protocol with local environment, return FALSE"); when(request.getServerName()).thenReturn("local.slidev.org"); when(request.isSecure()).thenReturn(false); assertFalse(SLIAuthenticationEntryPoint.isSecureRequest(request)); LOG.debug("[SLCAuthenticationEntryPointTest]Non-Secure Protocol with non-local environment, return FALSE"); when(request.getServerName()).thenReturn("rcdashboard.slidev.org"); when(request.isSecure()).thenReturn(false); assertFalse(SLIAuthenticationEntryPoint.isSecureRequest(request)); LOG.debug("[SLCAuthenticationEntryPointTest]Secure Protocol with non-local environment, return TRUE"); when(request.getServerName()).thenReturn("rcdashboard.slidev.org"); when(request.isSecure()).thenReturn(true); assertTrue(SLIAuthenticationEntryPoint.isSecureRequest(request)); }