/*
  * 1 covered goal:
  * 1 org.jsecurity.realm.activedirectory.ActiveDirectoryRealm.queryForAuthorizationInfo(Lorg/jsecurity/subject/PrincipalCollection;Lorg/jsecurity/realm/ldap/LdapContextFactory;)Lorg/jsecurity/authz/AuthorizationInfo;: root-Branch
  */
 @Test
 public void test1() throws Throwable {
   ActiveDirectoryRealm activeDirectoryRealm0 = new ActiveDirectoryRealm();
   SimpleAccount simpleAccount0 = new SimpleAccount((Object) "[]", (Object) "[]", "[]");
   SimplePrincipalCollection simplePrincipalCollection0 =
       (SimplePrincipalCollection) simpleAccount0.getPrincipals();
   // Undeclared exception!
   try {
     activeDirectoryRealm0.getAuthorizationInfo((PrincipalCollection) simplePrincipalCollection0);
     fail("Expecting exception: NoSuchElementException");
   } catch (NoSuchElementException e) {
   }
 }
  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
      throws AuthenticationException {
    UsernamePasswordToken upToken = (UsernamePasswordToken) token;
    SimpleAccount account = (SimpleAccount) getAuthorizationCache().get(upToken.getUsername());

    if (account.isLocked()) {
      throw new LockedAccountException("Account [" + account + "] is locked.");
    }
    if (account.isCredentialsExpired()) {
      String msg = "The credentials for account [" + account + "] are expired";
      throw new ExpiredCredentialsException(msg);
    }

    return account;
  }
 protected void add(SimpleAccount account) {
   Object key = getAuthorizationCacheKey(account.getPrincipals());
   getAuthorizationCache().put(key, account);
 }