Program: 59217
Project: 59217
Buggy source:
@Test public void createResourcePermission_caseSensitiveConsistent(){
  authenticateSystemResource();
  final String permissionNameBase=generateUniquePermissionName();
  final String permissionName_lower=permissionNameBase + "String_Node_Str";
  final String permissionName_UPPER=permissionNameBase + "String_Node_Str";
  final String resourceClassNameBase=generateUniquePermissionName();
  final String resourceClassName_lower=resourceClassNameBase + "String_Node_Str";
  accessControlContext.createResourceClass(resourceClassName_lower,false,false);
  List<String> permissionNames;
  if (isDatabaseCaseSensitive()) {
    final String resourceClassName_UPPER=resourceClassNameBase + "String_Node_Str";
    accessControlContext.createResourceClass(resourceClassName_UPPER,false,false);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.isEmpty(),is(true));
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.isEmpty(),is(true));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    accessControlContext.createResourcePermission(resourceClassName_UPPER,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_UPPER);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(2));
    assertThat(permissionNames,hasItems(permissionName_lower,permissionName_UPPER));
    accessControlContext.createResourcePermission(resourceClassName_UPPER,permissionName_UPPER);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.size(),is(2));
    assertThat(permissionNames,hasItems(permissionName_lower,permissionName_UPPER));
  }
 else {
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.isEmpty(),is(true));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_UPPER);
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void createResourcePermission_caseSensitiveConsistent(){
  authenticateSystemResource();
  final String permissionNameBase=generateUniquePermissionName();
  final String permissionName_lower=permissionNameBase + "String_Node_Str";
  final String permissionName_UPPER=permissionNameBase + "String_Node_Str";
  final String resourceClassNameBase=generateUniquePermissionName();
  final String resourceClassName_lower=resourceClassNameBase + "String_Node_Str";
  accessControlContext.createResourceClass(resourceClassName_lower,false,false);
  List<String> permissionNames;
  if (isDatabaseCaseSensitive()) {
    final String resourceClassName_UPPER=resourceClassNameBase + "String_Node_Str";
    accessControlContext.createResourceClass(resourceClassName_UPPER,false,false);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.isEmpty(),is(true));
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.isEmpty(),is(true));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    accessControlContext.createResourcePermission(resourceClassName_UPPER,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_UPPER);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(2));
    assertThat(permissionNames,hasItems(permissionName_lower,permissionName_UPPER));
    accessControlContext.createResourcePermission(resourceClassName_UPPER,permissionName_UPPER);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_UPPER);
    assertThat(permissionNames.size(),is(2));
    assertThat(permissionNames,hasItems(permissionName_lower,permissionName_UPPER));
  }
 else {
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.isEmpty(),is(true));
    accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_lower);
    permissionNames=accessControlContext.getResourcePermissionNames(resourceClassName_lower);
    assertThat(permissionNames.size(),is(1));
    assertThat(permissionNames,hasItem(permissionName_lower));
    assertThat(permissionNames,not(hasItem(permissionName_UPPER)));
    try {
      accessControlContext.createResourcePermission(resourceClassName_lower,permissionName_UPPER);
      fail("String_Node_Str");
    }
 catch (    IllegalArgumentException e) {
      assertThat(e.getMessage().toLowerCase(),containsString("String_Node_Str"));
    }
  }
}