Program: 60592
Project: 60592
Buggy source:
@Test public void reconcileFromLDAP(){
  SyncTaskTO task=taskService.read(TaskType.SYNCHRONIZATION,11L);
  assertNotNull(task);
  RoleTO template=new RoleTO();
  template.setParent(8L);
  template.addAttribute(attributeTO("String_Node_Str","String_Node_Str"));
  task.setRoleTemplate(template);
  taskService.update(task.getId(),task);
  SyncTaskTO actual=taskService.read(TaskType.SYNCHRONIZATION,task.getId());
  assertNotNull(actual);
  assertEquals(task.getId(),actual.getId());
  assertEquals(template,actual.getRoleTemplate());
  assertEquals(new UserTO(),actual.getUserTemplate());
  TaskExecTO execution=execSyncTask(actual.getId(),20,false);
  final String status=execution.getStatus();
  assertNotNull(status);
  assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
  final AttributableCond rolenameLeafCond=new AttributableCond(AttributableCond.Type.EQ);
  rolenameLeafCond.setSchema("String_Node_Str");
  rolenameLeafCond.setExpression("String_Node_Str");
  final List<RoleTO> matchingRoles=roleService.search(NodeCond.getLeafCond(rolenameLeafCond));
  assertNotNull(matchingRoles);
  assertEquals(1,matchingRoles.size());
  final AttributableCond usernameLeafCond=new AttributableCond(AttributeCond.Type.EQ);
  usernameLeafCond.setSchema("String_Node_Str");
  usernameLeafCond.setExpression("String_Node_Str");
  final List<UserTO> matchingUsers=userService.search(NodeCond.getLeafCond(usernameLeafCond));
  assertNotNull(matchingUsers);
  assertEquals(1,matchingUsers.size());
  final RoleTO roleTO=matchingRoles.iterator().next();
  assertNotNull(roleTO);
  assertEquals("String_Node_Str",roleTO.getName());
  assertEquals(8L,roleTO.getParent());
  assertEquals("String_Node_Str",roleTO.getAttributeMap().get("String_Node_Str").getValues().get(0));
  assertEquals(matchingUsers.iterator().next().getId(),(long)roleTO.getUserOwner());
  assertNull(roleTO.getRoleOwner());
  final MembershipCond membershipCond=new MembershipCond();
  membershipCond.setRoleId(roleTO.getId());
  final List<UserTO> members=userService.search(NodeCond.getLeafCond(membershipCond));
  assertNotNull(members);
  assertEquals(1,members.size());
}

Fixed version (ground truth):
@Test public void reconcileFromLDAP() throws InvalidSearchConditionException {
  SyncTaskTO task=taskService.read(TaskType.SYNCHRONIZATION,11L);
  assertNotNull(task);
  RoleTO template=new RoleTO();
  template.setParent(8L);
  template.addAttribute(attributeTO("String_Node_Str","String_Node_Str"));
  task.setRoleTemplate(template);
  taskService.update(task.getId(),task);
  SyncTaskTO actual=taskService.read(TaskType.SYNCHRONIZATION,task.getId());
  assertNotNull(actual);
  assertEquals(task.getId(),actual.getId());
  assertEquals(template,actual.getRoleTemplate());
  assertEquals(new UserTO(),actual.getUserTemplate());
  TaskExecTO execution=execSyncTask(actual.getId(),20,false);
  final String status=execution.getStatus();
  assertNotNull(status);
  assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
  final AttributableCond rolenameLeafCond=new AttributableCond(AttributableCond.Type.EQ);
  rolenameLeafCond.setSchema("String_Node_Str");
  rolenameLeafCond.setExpression("String_Node_Str");
  final List<RoleTO> matchingRoles=roleService.search(NodeCond.getLeafCond(rolenameLeafCond));
  assertNotNull(matchingRoles);
  assertEquals(1,matchingRoles.size());
  final AttributableCond usernameLeafCond=new AttributableCond(AttributeCond.Type.EQ);
  usernameLeafCond.setSchema("String_Node_Str");
  usernameLeafCond.setExpression("String_Node_Str");
  final List<UserTO> matchingUsers=userService.search(NodeCond.getLeafCond(usernameLeafCond));
  assertNotNull(matchingUsers);
  assertEquals(1,matchingUsers.size());
  final RoleTO roleTO=matchingRoles.iterator().next();
  assertNotNull(roleTO);
  assertEquals("String_Node_Str",roleTO.getName());
  assertEquals(8L,roleTO.getParent());
  assertEquals("String_Node_Str",roleTO.getAttributeMap().get("String_Node_Str").getValues().get(0));
  assertEquals(matchingUsers.iterator().next().getId(),(long)roleTO.getUserOwner());
  assertNull(roleTO.getRoleOwner());
  final MembershipCond membershipCond=new MembershipCond();
  membershipCond.setRoleId(roleTO.getId());
  final List<UserTO> members=userService.search(NodeCond.getLeafCond(membershipCond));
  assertNotNull(members);
  assertEquals(1,members.size());
}