Program: 60575
Project: 60575
Buggy source:
@Test public void testUserSchemaAuthorization(){
  RoleTO authRoleTO=new RoleTO();
  authRoleTO.setName("String_Node_Str" + getUUIDString());
  authRoleTO.setParent(8L);
  authRoleTO.addEntitlement("String_Node_Str");
  Response response=roleService.create(authRoleTO);
  authRoleTO=getObject(response,RoleTO.class,roleService);
  assertNotNull(authRoleTO);
  SchemaTO schemaTO=new SchemaTO();
  schemaTO.setName("String_Node_Str");
  schemaTO.setMandatoryCondition("String_Node_Str");
  schemaTO.setType(SchemaType.String);
  response=schemaService.create(AttributableType.USER,SchemaService.SchemaType.NORMAL,schemaTO);
  SchemaTO newSchemaTO=getObject(response,SchemaTO.class,entitlementService);
  assertEquals(schemaTO,newSchemaTO);
  UserTO userTO=UserTestITCase.getUniqueSampleTO("String_Node_Str");
  MembershipTO membershipTO=new MembershipTO();
  membershipTO.setRoleId(authRoleTO.getId());
  AttributeTO testAttributeTO=new AttributeTO();
  testAttributeTO.setSchema("String_Node_Str");
  testAttributeTO.addValue("String_Node_Str");
  membershipTO.addAttribute(testAttributeTO);
  userTO.addMembership(membershipTO);
  userTO=createUser(userTO);
  assertNotNull(userTO);
  schemaTO=schemaService.read(AttributableType.USER,SchemaService.SchemaType.NORMAL,"String_Node_Str");
  assertNotNull(schemaTO);
  SchemaService schemaService2=setupCredentials(schemaService,userTO.getUsername(),"String_Node_Str");
  schemaTO=schemaService2.read(AttributableType.USER,SchemaService.SchemaType.NORMAL,"String_Node_Str");
  assertNotNull(schemaTO);
  HttpClientErrorException exception=null;
  try {
    schemaService2.update(AttributableType.ROLE,SchemaService.SchemaType.NORMAL,schemaTO.getName(),schemaTO);
  }
 catch (  HttpClientErrorException e) {
    exception=e;
  }
  assertNotNull(exception);
  assertEquals(HttpStatus.FORBIDDEN,exception.getStatusCode());
  super.resetRestTemplate();
  userTO=userService.read(userTO.getId());
  assertNotNull(userTO);
  assertNotNull(userTO.getLastLoginDate());
  assertEquals(Integer.valueOf(0),userTO.getFailedLogins());
}

Fixed version (ground truth):
@Test public void testUserSchemaAuthorization(){
  RoleTO authRoleTO=new RoleTO();
  authRoleTO.setName("String_Node_Str" + getUUIDString());
  authRoleTO.setParent(8L);
  authRoleTO.addEntitlement("String_Node_Str");
  Response response=roleService.create(authRoleTO);
  authRoleTO=getObject(response,RoleTO.class,roleService);
  assertNotNull(authRoleTO);
  SchemaTO schemaTO=new SchemaTO();
  schemaTO.setName("String_Node_Str");
  schemaTO.setMandatoryCondition("String_Node_Str");
  schemaTO.setType(SchemaType.String);
  response=schemaService.create(AttributableType.USER,SchemaService.SchemaType.NORMAL,schemaTO);
  SchemaTO newSchemaTO=getObject(response,SchemaTO.class,entitlementService);
  assertEquals(schemaTO,newSchemaTO);
  UserTO userTO=UserTestITCase.getUniqueSampleTO("String_Node_Str");
  MembershipTO membershipTO=new MembershipTO();
  membershipTO.setRoleId(authRoleTO.getId());
  AttributeTO testAttributeTO=new AttributeTO();
  testAttributeTO.setSchema("String_Node_Str");
  testAttributeTO.addValue("String_Node_Str");
  membershipTO.addAttribute(testAttributeTO);
  userTO.addMembership(membershipTO);
  userTO=createUser(userTO);
  assertNotNull(userTO);
  schemaTO=schemaService.read(AttributableType.USER,SchemaService.SchemaType.NORMAL,"String_Node_Str");
  assertNotNull(schemaTO);
  SchemaService schemaService2=setupCredentials(schemaService,SchemaService.class,userTO.getUsername(),"String_Node_Str");
  schemaTO=schemaService2.read(AttributableType.USER,SchemaService.SchemaType.NORMAL,"String_Node_Str");
  assertNotNull(schemaTO);
  HttpClientErrorException exception=null;
  try {
    schemaService2.update(AttributableType.ROLE,SchemaService.SchemaType.NORMAL,schemaTO.getName(),schemaTO);
  }
 catch (  HttpClientErrorException e) {
    exception=e;
  }
  assertNotNull(exception);
  assertEquals(HttpStatus.FORBIDDEN,exception.getStatusCode());
  super.resetRestTemplate();
  userTO=userService.read(userTO.getId());
  assertNotNull(userTO);
  assertNotNull(userTO.getLastLoginDate());
  assertEquals(Integer.valueOf(0),userTO.getFailedLogins());
}