Program: 69708
Project: 69708
Buggy source:
@Test public void testRemoveAuthor() throws IOException, URISyntaxException {
  BaseSecurity securityManager=BaseSecurityManager.getInstance();
  SecurityGroup authorGroup=securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
  if (!securityManager.isIdentityInSecurityGroup(auth1,authorGroup)) {
    securityManager.addIdentityToSecurityGroup(auth1,authorGroup);
  }
  if (!securityManager.isIdentityInSecurityGroup(auth2,authorGroup)) {
    securityManager.addIdentityToSecurityGroup(auth2,authorGroup);
  }
  DBFactory.getInstance().intermediateCommit();
  RepositoryManager rm=RepositoryManager.getInstance();
  RepositoryEntry repositoryEntry=rm.lookupRepositoryEntry(course1,true);
  List<Identity> authors=new ArrayList<Identity>();
  authors.add(auth1);
  authors.add(auth2);
  IdentitiesAddEvent identitiesAddedEvent=new IdentitiesAddEvent(authors);
  rm.addOwners(admin,identitiesAddedEvent,repositoryEntry);
  DBFactory.getInstance().intermediateCommit();
  assertTrue(conn.login("String_Node_Str","String_Node_Str"));
  URI request=UriBuilder.fromUri(getContextURI()).path("String_Node_Str" + course1.getResourceableId() + "String_Node_Str"+ auth1.getKey()).build();
  HttpDelete method=conn.createDelete(request,MediaType.APPLICATION_JSON,true);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  EntityUtils.consume(response.getEntity());
  URI request2=UriBuilder.fromUri(getContextURI()).path("String_Node_Str" + course1.getResourceableId() + "String_Node_Str"+ auth2.getKey()).build();
  HttpDelete method2=conn.createDelete(request2,MediaType.APPLICATION_JSON,true);
  HttpResponse response2=conn.execute(method2);
  assertEquals(200,response2.getStatusLine().getStatusCode());
  EntityUtils.consume(response2.getEntity());
  repositoryEntry=rm.lookupRepositoryEntry(course1,true);
  SecurityGroup ownerGroup=repositoryEntry.getOwnerGroup();
  assertFalse(securityManager.isIdentityInSecurityGroup(auth1,ownerGroup));
  assertFalse(securityManager.isIdentityInSecurityGroup(auth2,ownerGroup));
  DBFactory.getInstance().intermediateCommit();
}

Fixed version (ground truth):
@Test public void testRemoveAuthor() throws IOException, URISyntaxException {
  BaseSecurity securityManager=BaseSecurityManager.getInstance();
  SecurityGroup authorGroup=securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
  if (!securityManager.isIdentityInSecurityGroup(auth1,authorGroup)) {
    securityManager.addIdentityToSecurityGroup(auth1,authorGroup);
  }
  if (!securityManager.isIdentityInSecurityGroup(auth2,authorGroup)) {
    securityManager.addIdentityToSecurityGroup(auth2,authorGroup);
  }
  DBFactory.getInstance().intermediateCommit();
  RepositoryManager rm=RepositoryManager.getInstance();
  RepositoryEntry repositoryEntry=rm.lookupRepositoryEntry(course1,true);
  List<Identity> authors=new ArrayList<Identity>();
  authors.add(auth1);
  authors.add(auth2);
  IdentitiesAddEvent identitiesAddedEvent=new IdentitiesAddEvent(authors);
  rm.addOwners(admin,identitiesAddedEvent,repositoryEntry);
  DBFactory.getInstance().intermediateCommit();
  assertTrue(conn.login("String_Node_Str","String_Node_Str"));
  URI request=UriBuilder.fromUri(getContextURI()).path("String_Node_Str" + course1.getResourceableId() + "String_Node_Str"+ auth1.getKey()).build();
  HttpDelete method=conn.createDelete(request,MediaType.APPLICATION_JSON);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  EntityUtils.consume(response.getEntity());
  URI request2=UriBuilder.fromUri(getContextURI()).path("String_Node_Str" + course1.getResourceableId() + "String_Node_Str"+ auth2.getKey()).build();
  HttpDelete method2=conn.createDelete(request2,MediaType.APPLICATION_JSON);
  HttpResponse response2=conn.execute(method2);
  assertEquals(200,response2.getStatusLine().getStatusCode());
  EntityUtils.consume(response2.getEntity());
  repositoryEntry=rm.lookupRepositoryEntry(course1,true);
  SecurityGroup ownerGroup=repositoryEntry.getOwnerGroup();
  assertFalse(securityManager.isIdentityInSecurityGroup(auth1,ownerGroup));
  assertFalse(securityManager.isIdentityInSecurityGroup(auth2,ownerGroup));
  DBFactory.getInstance().intermediateCommit();
}