@Test
public void testAuthId() throws Exception {

  Integer userId = AuthorizationHelper.getAuthenticatedId();
  Assert.assertEquals(Integer.valueOf(-1), userId);
  PrincipalEntity principalEntity = new PrincipalEntity();
  UserEntity userEntity = new UserEntity();
  userEntity.setUserId(1);
  userEntity.setPrincipal(principalEntity);
  User user = new User(userEntity);
  Authentication auth = new AmbariUserAuthentication(null, user, null);
  SecurityContextHolder.getContext().setAuthentication(auth);
  userId = AuthorizationHelper.getAuthenticatedId();
  Assert.assertEquals(Integer.valueOf(1), userId);
}