Program: 34782
Project: 34782
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_false() 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);
  final List<String> groupIds=new ArrayList<String>();
  groupIds.add("String_Node_Str");
  HashSet<Object> privCredentials=new HashSet<Object>();
  final Subject subject=new Subject(false,principals,pubCredentials,privCredentials);
  requiredRoles.add(role1);
  assignedRoles=new RoleSet(requiredRoles);
  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(returnValue(accessId1));
      one(authzTableService).getRolesForAccessId(resourceName,accessId1);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
      one(wsCred).getGroupIds();
      will(returnValue(groupIds));
      one(authzTableService).getRolesForAccessId(resourceName,groupAccessId1);
      will(returnValue(assignedRoles));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,assignedRoles,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_false() 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);
  final List<String> groupIds=new ArrayList<String>();
  groupIds.add("String_Node_Str");
  HashSet<Object> privCredentials=new HashSet<Object>();
  final Subject subject=new Subject(false,principals,pubCredentials,privCredentials);
  requiredRoles.add(role1);
  assignedRoles=new RoleSet(requiredRoles);
  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(returnValue(accessId1));
      one(wsCred).getRealmName();
      will(returnValue(realmName1));
      one(authzTableService).getRolesForAccessId(resourceName,accessId1,realmName1);
      will(returnValue(RoleSet.EMPTY_ROLESET));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,RoleSet.EMPTY_ROLESET,subject);
      will(returnValue(Boolean.FALSE));
      one(wsCred).getGroupIds();
      will(returnValue(groupIds));
      one(authzTableService).getRolesForAccessId(resourceName,groupAccessId1,realmName1);
      will(returnValue(assignedRoles));
      one(accessDecisionService).isGranted(resourceName,requiredRoles,assignedRoles,subject);
      will(returnValue(Boolean.FALSE));
    }
  }
);
  assertFalse("String_Node_Str",builtinAuthz.isAuthorized(resourceName,requiredRoles,subject));
}