Program: 25718
Project: 25718
Buggy source:
@Test public void createSynapseProjectTeam() throws SynapseException {
  study=TestUtils.getValidStudy(StudyServiceTest.class);
  study.setSynapseDataAccessTeamId(null);
  study.setSynapseProjectId(null);
  studyService.createStudy(study);
  Study retStudy=studyService.createSynapseProjectTeam(TEST_USER_ID,study);
  assertEquals(retStudy.getIdentifier(),study.getIdentifier());
  String projectId=retStudy.getSynapseProjectId();
  Long teamId=retStudy.getSynapseDataAccessTeamId();
  Entity project=synapseClient.getEntityById(projectId);
  assertNotNull(project);
  assertEquals(project.getEntityType(),"String_Node_Str");
  this.project=(Project)project;
  Team team=synapseClient.getTeam(teamId.toString());
  assertNotNull(team);
  this.team=team;
  AccessControlList projectAcl=synapseClient.getACL(projectId);
  Set<ResourceAccess> projectRa=projectAcl.getResourceAccess();
  assertNotNull(projectRa);
  assertEquals(projectRa.size(),3);
  List<ResourceAccess> retListForExporter=projectRa.stream().filter(ra -> ra.getPrincipalId().equals(Long.parseLong(EXPORTER_SYNAPSE_USER_ID))).collect(Collectors.toList());
  assertNotNull(retListForExporter);
  assertEquals(retListForExporter.size(),1);
  ResourceAccess exporterRa=retListForExporter.get(0);
  assertNotNull(exporterRa);
  assertEquals(exporterRa.getPrincipalId().toString(),EXPORTER_SYNAPSE_USER_ID);
  assertEquals(exporterRa.getAccessType(),ModelConstants.ENITY_ADMIN_ACCESS_PERMISSIONS);
  List<ResourceAccess> retListForUser=projectRa.stream().filter(ra -> ra.getPrincipalId().equals(TEST_USER_ID)).collect(Collectors.toList());
  assertNotNull(retListForUser);
  assertEquals(retListForUser.size(),1);
  ResourceAccess userRa=retListForUser.get(0);
  assertNotNull(userRa);
  assertEquals(userRa.getPrincipalId(),TEST_USER_ID);
  assertEquals(userRa.getAccessType(),ModelConstants.ENITY_ADMIN_ACCESS_PERMISSIONS);
  PaginatedResults<MembershipInvtnSubmission> retInvitations=synapseClient.getOpenMembershipInvitationSubmissions(teamId.toString(),TEST_USER_ID.toString(),1,0);
  List<MembershipInvtnSubmission> invitationList=retInvitations.getResults();
  assertEquals(invitationList.size(),1);
  MembershipInvtnSubmission invtnSubmission=invitationList.get(0);
  assertEquals(invtnSubmission.getInviteeId(),TEST_USER_ID.toString());
  assertEquals(invtnSubmission.getTeamId(),teamId.toString());
}

Fixed version (ground truth):
@Test public void createSynapseProjectTeam() throws SynapseException {
  study=TestUtils.getValidStudy(StudyServiceTest.class);
  study.setSynapseDataAccessTeamId(null);
  study.setSynapseProjectId(null);
  studyService.createStudy(study);
  Study retStudy=studyService.createSynapseProjectTeam(TEST_USER_ID,study);
  String projectId=retStudy.getSynapseProjectId();
  Long teamId=retStudy.getSynapseDataAccessTeamId();
  Entity project=synapseClient.getEntityById(projectId);
  this.project=(Project)project;
  Team team=synapseClient.getTeam(teamId.toString());
  this.team=team;
  assertEquals(retStudy.getIdentifier(),study.getIdentifier());
  assertNotNull(project);
  assertEquals(project.getEntityType(),"String_Node_Str");
  assertNotNull(team);
  AccessControlList projectAcl=synapseClient.getACL(projectId);
  Set<ResourceAccess> projectRa=projectAcl.getResourceAccess();
  assertNotNull(projectRa);
  assertEquals(projectRa.size(),3);
  List<ResourceAccess> retListForExporter=projectRa.stream().filter(ra -> ra.getPrincipalId().equals(Long.parseLong(EXPORTER_SYNAPSE_USER_ID))).collect(Collectors.toList());
  assertNotNull(retListForExporter);
  assertEquals(retListForExporter.size(),1);
  ResourceAccess exporterRa=retListForExporter.get(0);
  assertNotNull(exporterRa);
  assertEquals(exporterRa.getPrincipalId().toString(),EXPORTER_SYNAPSE_USER_ID);
  assertEquals(exporterRa.getAccessType(),ModelConstants.ENITY_ADMIN_ACCESS_PERMISSIONS);
  List<ResourceAccess> retListForUser=projectRa.stream().filter(ra -> ra.getPrincipalId().equals(TEST_USER_ID)).collect(Collectors.toList());
  assertNotNull(retListForUser);
  assertEquals(retListForUser.size(),1);
  ResourceAccess userRa=retListForUser.get(0);
  assertNotNull(userRa);
  assertEquals(userRa.getPrincipalId(),TEST_USER_ID);
  assertEquals(userRa.getAccessType(),ModelConstants.ENITY_ADMIN_ACCESS_PERMISSIONS);
  PaginatedResults<MembershipInvtnSubmission> retInvitations=synapseClient.getOpenMembershipInvitationSubmissions(teamId.toString(),TEST_USER_ID.toString(),1,0);
  List<MembershipInvtnSubmission> invitationList=retInvitations.getResults();
  assertEquals(invitationList.size(),1);
  MembershipInvtnSubmission invtnSubmission=invitationList.get(0);
  assertEquals(invtnSubmission.getInviteeId(),TEST_USER_ID.toString());
  assertEquals(invtnSubmission.getTeamId(),teamId.toString());
}