Program: 5954
Project: 5954
Buggy source:
@Test public void testCreateExist() throws Exception {
  SecurityRequestContext.setUserId(USER.getName());
  StreamAdmin streamAdmin=getStreamAdmin();
  String streamName="String_Node_Str";
  Id.Stream streamId=Id.Stream.from(FOO_NAMESPACE,streamName);
  Id.Stream otherStreamId=Id.Stream.from(OTHER_NAMESPACE,streamName);
  Assert.assertFalse(streamAdmin.exists(streamId));
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  try {
    streamAdmin.create(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.getNamespace().toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  streamAdmin.create(streamId);
  Assert.assertTrue(streamAdmin.exists(streamId));
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  try {
    streamAdmin.create(otherStreamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(otherStreamId.getNamespace().toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  streamAdmin.create(otherStreamId);
  Assert.assertTrue(streamAdmin.exists(otherStreamId));
  streamAdmin.drop(otherStreamId);
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  revokeAndAssertSuccess(streamId.toEntityId(),USER,ImmutableSet.of(Action.ADMIN,Action.ALL));
  try {
    streamAdmin.drop(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  try {
    streamAdmin.drop(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.toEntityId(),USER,ImmutableSet.of(Action.ADMIN));
  streamAdmin.drop(streamId);
  Assert.assertFalse(streamAdmin.exists(streamId));
}

Fixed version (ground truth):
@Test public void testCreateExist() throws Exception {
  SecurityRequestContext.setUserId(USER.getName());
  StreamAdmin streamAdmin=getStreamAdmin();
  String streamName="String_Node_Str";
  Id.Stream streamId=Id.Stream.from(FOO_NAMESPACE,streamName);
  Id.Stream otherStreamId=Id.Stream.from(OTHER_NAMESPACE,streamName);
  Assert.assertFalse(streamAdmin.exists(streamId));
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  try {
    streamAdmin.create(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.getNamespace().toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  streamAdmin.create(streamId);
  Assert.assertTrue(streamAdmin.exists(streamId));
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  try {
    streamAdmin.create(otherStreamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(otherStreamId.getNamespace().toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  streamAdmin.create(otherStreamId);
  Assert.assertTrue(streamAdmin.exists(otherStreamId));
  streamAdmin.drop(otherStreamId);
  Assert.assertFalse(streamAdmin.exists(otherStreamId));
  revokeAndAssertSuccess(streamId.toEntityId(),USER,EnumSet.allOf(Action.class));
  try {
    streamAdmin.drop(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  try {
    streamAdmin.drop(streamId);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(streamId.toEntityId(),USER,ImmutableSet.of(Action.ADMIN));
  streamAdmin.drop(streamId);
  Assert.assertFalse(streamAdmin.exists(streamId));
}