Program: 6083
Project: 6083
Buggy source:
@Test public void testSecureStoreAccess() throws Exception {
  final SecureKeyId secureKeyId1=NamespaceId.DEFAULT.secureKey(KEY1);
  SecurityRequestContext.setUserId(ALICE.getName());
  final SecureKeyCreateRequest createRequest=new SecureKeyCreateRequest(DESCRIPTION1,VALUE1,Collections.<String,String>emptyMap());
  try {
    secureStoreService.put(secureKeyId1,createRequest);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  grantAndAssertSuccess(NamespaceId.DEFAULT,ALICE,ImmutableSet.of(Action.WRITE));
  secureStoreService.put(secureKeyId1,createRequest);
  List<SecureKeyListEntry> secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(secureKeyListEntries.size(),1);
  Assert.assertEquals(secureKeyListEntries.get(0).getName(),KEY1);
  Assert.assertEquals(secureKeyListEntries.get(0).getDescription(),DESCRIPTION1);
  revokeAndAssertSuccess(secureKeyId1,ALICE,ImmutableSet.of(Action.ALL));
  secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(0,secureKeyListEntries.size());
  SecurityRequestContext.setUserId(BOB.getName());
  grantAndAssertSuccess(secureKeyId1,BOB,ImmutableSet.of(Action.READ));
  Assert.assertArrayEquals(secureStoreService.get(secureKeyId1).get(),VALUE1.getBytes());
  secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(1,secureKeyListEntries.size());
  try {
    secureStoreService.delete(secureKeyId1);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  grantAndAssertSuccess(secureKeyId1,BOB,ImmutableSet.of(Action.ADMIN));
  secureStoreService.delete(secureKeyId1);
  Assert.assertEquals(0,secureStoreService.list(NamespaceId.DEFAULT).size());
  Predicate<Privilege> secureKeyIdFilter=new Predicate<Privilege>(){
    @Override public boolean apply(    Privilege input){
      return input.getEntity().equals(secureKeyId1);
    }
  }
;
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(ALICE),secureKeyIdFilter).isEmpty());
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(BOB),secureKeyIdFilter).isEmpty());
}

Fixed version (ground truth):
@Test public void testSecureStoreAccess() throws Exception {
  final SecureKeyId secureKeyId1=NamespaceId.DEFAULT.secureKey(KEY1);
  SecurityRequestContext.setUserId(ALICE.getName());
  final SecureKeyCreateRequest createRequest=new SecureKeyCreateRequest(DESCRIPTION1,VALUE1,Collections.<String,String>emptyMap());
  try {
    secureStoreService.put(secureKeyId1,createRequest);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  grantAndAssertSuccess(NamespaceId.DEFAULT,ALICE,ImmutableSet.of(Action.WRITE));
  secureStoreService.put(secureKeyId1,createRequest);
  List<SecureKeyListEntry> secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(secureKeyListEntries.size(),1);
  Assert.assertEquals(secureKeyListEntries.get(0).getName(),KEY1);
  Assert.assertEquals(secureKeyListEntries.get(0).getDescription(),DESCRIPTION1);
  revokeAndAssertSuccess(secureKeyId1,ALICE,ImmutableSet.of(Action.ALL));
  secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(0,secureKeyListEntries.size());
  SecurityRequestContext.setUserId(BOB.getName());
  grantAndAssertSuccess(NamespaceId.DEFAULT,BOB,ImmutableSet.of(Action.READ));
  grantAndAssertSuccess(secureKeyId1,BOB,ImmutableSet.of(Action.READ));
  Assert.assertArrayEquals(secureStoreService.get(secureKeyId1).get(),VALUE1.getBytes());
  secureKeyListEntries=secureStoreService.list(NamespaceId.DEFAULT);
  Assert.assertEquals(1,secureKeyListEntries.size());
  try {
    secureStoreService.delete(secureKeyId1);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException expected) {
  }
  grantAndAssertSuccess(secureKeyId1,BOB,ImmutableSet.of(Action.ADMIN));
  secureStoreService.delete(secureKeyId1);
  Assert.assertEquals(0,secureStoreService.list(NamespaceId.DEFAULT).size());
  Predicate<Privilege> secureKeyIdFilter=new Predicate<Privilege>(){
    @Override public boolean apply(    Privilege input){
      return input.getEntity().equals(secureKeyId1);
    }
  }
;
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(ALICE),secureKeyIdFilter).isEmpty());
  Assert.assertTrue(Sets.filter(authorizer.listPrivileges(BOB),secureKeyIdFilter).isEmpty());
}