/** * logs out the "active" (authenticated) user within context * * @see #authenticate * @should not fail if session hasn't been opened yet */ public static void logout() { if (!isSessionOpen()) { return; // fail early if there isn't even a session open } log.debug("Logging out : {}", getAuthenticatedUser()); getUserContext().logout(); // reset the UserContext object (usually cleared out by closeSession() // soon after this) setUserContext(new UserContext()); }
@Test(expected = APIAuthenticationException.class) public void before_shouldThrowAPIAuthenticationException() { Context.getUserContext().logout(); Context.getConceptService().getConcept(3); }