### Question:
JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { response.addHeader( HttpHeaders.WWW_AUTHENTICATE, "Bearer error=\"Invalid access token\"" ); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); }  @Override void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException);  }### Answer:
@Test public void shouldReturnUnauthorized() throws Exception { JwtAuthenticationEntryPoint entryPoint = new JwtAuthenticationEntryPoint(); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); AuthenticationException exception = mock(AuthenticationException.class); entryPoint.commence(request, response, exception); verify(response).addHeader( "WWW-Authenticate", "Bearer error=\"Invalid access token\"" ); verify(response).sendError(401, "Unauthorized"); }