Program: 34781
Project: 34781
Buggy source:
/** 
 * Test method for  {@link com.ibm.ws.security.authorization.builtin.internal.BuiltinAuthorizationService#isAuthorized(java.lang.Object,java.util.List,javax.security.auth.Subject)} .
 * @throws CredentialDestroyedException
 * @throws CredentialExpiredException
 */
@Test public void testIsAuthorized_falseWSCredThrowsCredentialDestroyedException() throws Exception {
  WSPrincipal princ=new WSPrincipal(subject1,accessId1,authMethod);
  Set<Principal> principals=new HashSet<Principal>();
  principals.add(princ);
  HashSet<Object> pubCredentials=new HashSet<Object>();
  pubCredentials.add(wsCred);
  HashSet<Object> privCredentials=new HashSet<Object>();
  final Subject subject=new Subject(false,principals,pubCredentials,privCredentials);
  requiredRoles.add(role1);
  context.checking(new Expectations(){
{
      one(authzTableService).getRolesForSpecialSubject(resourceName,AuthorizationTableService.EVERYONE);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,null);
      will(returnValue(Boolean.FALSE));
      one(wsCred).isUnauthenticated();
      will(returnValue(Boolean.FALSE));
      one(wsCred).isBasicAuth();
      will(returnValue(Boolean.FALSE));
      one(authzTableService).getRolesForSpecialSubject(resourceName,AuthorizationTableService.ALL_AUTHENTICATED_USERS);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
      one(wsCred).getAccessId();
      will(throwException(new CredentialDestroyedException("String_Node_Str")));
      one(wsCred).getGroupIds();
      will(throwException(new CredentialDestroyedException("String_Node_Str")));
      one(authzTableService).getRolesForAccessId(resourceName,null);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
    }
  }
);
  assertFalse("String_Node_Str",builtinAuthz.isAuthorized(resourceName,requiredRoles,subject));
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.ibm.ws.security.authorization.builtin.internal.BuiltinAuthorizationService#isAuthorized(java.lang.Object,java.util.List,javax.security.auth.Subject)} .
 * @throws CredentialDestroyedException
 * @throws CredentialExpiredException
 */
@Test public void testIsAuthorized_falseWSCredThrowsCredentialDestroyedException() throws Exception {
  WSPrincipal princ=new WSPrincipal(subject1,accessId1,authMethod);
  Set<Principal> principals=new HashSet<Principal>();
  principals.add(princ);
  HashSet<Object> pubCredentials=new HashSet<Object>();
  pubCredentials.add(wsCred);
  HashSet<Object> privCredentials=new HashSet<Object>();
  final Subject subject=new Subject(false,principals,pubCredentials,privCredentials);
  requiredRoles.add(role1);
  context.checking(new Expectations(){
{
      one(authzTableService).getRolesForSpecialSubject(resourceName,AuthorizationTableService.EVERYONE);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,null);
      will(returnValue(Boolean.FALSE));
      one(wsCred).isUnauthenticated();
      will(returnValue(Boolean.FALSE));
      one(wsCred).isBasicAuth();
      will(returnValue(Boolean.FALSE));
      one(authzTableService).getRolesForSpecialSubject(resourceName,AuthorizationTableService.ALL_AUTHENTICATED_USERS);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
      one(wsCred).getAccessId();
      will(throwException(new CredentialDestroyedException("String_Node_Str")));
      one(wsCred).getGroupIds();
      will(throwException(new CredentialDestroyedException("String_Node_Str")));
      one(wsCred).getRealmName();
      will(throwException(new CredentialExpiredException("String_Node_Str")));
      one(authzTableService).getRolesForAccessId(resourceName,null,null);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
    }
  }
);
  assertFalse("String_Node_Str",builtinAuthz.isAuthorized(resourceName,requiredRoles,subject));
}