@Test (timeout = 30000)
public void testGetUGIFromSubject() throws Exception {

  KerberosPrincipal p = new KerberosPrincipal("guest");
  Subject subject = new Subject();
  subject.getPrincipals().add(p);
  UserGroupInformation ugi = UserGroupInformation.getUGIFromSubject(subject);
  assertNotNull(ugi);
  assertEquals("guest@DEFAULT.REALM", ugi.getUserName());
}