public void testLogout() throws Exception {
Authentication auth = new Authentication();
auth.setAuthorizations(new BaseAuthorization[0]);
auth.setSecurityServiceId(StaticSecurityService.SECURITY_SERVICE_ID); // mimic that this comes from the StaticSecurity stuff
String token = tokenService.login(auth);
SecurityContextImpl securityContext = (SecurityContextImpl) this.securityContext;
List<Authentication> auths = new ArrayList<Authentication>();
auths.add(auth);
securityContext.setAuthentications(token, auths);
Assert.assertEquals(token, securityContext.getToken());
EmptyCommandRequest request = new EmptyCommandRequest();
SuccessCommandResponse response = logoutCommand.getEmptyCommandResponse();
logoutCommand.execute(request, response);
Assert.assertTrue(response.isSuccess());
Assert.assertNull(tokenService.getAuthentication(token));