/** * @verifies return forbidden if logged in * @see BaseRestController#apiAuthenticationExceptionHandler(Exception, * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Test public void apiAuthenticationExceptionHandler_shouldReturnForbiddenIfLoggedIn() throws Exception { controller.apiAuthenticationExceptionHandler( new APIAuthenticationException(), request, response); assertThat(response.getStatus(), is(HttpServletResponse.SC_FORBIDDEN)); }
/** * @verifies return unauthorized if not logged in * @see BaseRestController#apiAuthenticationExceptionHandler(Exception, * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Test public void apiAuthenticationExceptionHandler_shouldReturnUnauthorizedIfNotLoggedIn() throws Exception { Context.logout(); controller.apiAuthenticationExceptionHandler( new APIAuthenticationException(), request, response); assertThat(response.getStatus(), is(HttpServletResponse.SC_UNAUTHORIZED)); }