Program: 5953
Project: 5953
Buggy source:
@Test public void testConfigAndTruncate() throws Exception {
  StreamAdmin streamAdmin=getStreamAdmin();
  grantAndAssertSuccess(new NamespaceId(FOO_NAMESPACE),USER,ImmutableSet.of(Action.WRITE));
  Id.Stream stream=Id.Stream.from(FOO_NAMESPACE,"String_Node_Str");
  streamAdmin.create(stream);
  Assert.assertTrue(streamAdmin.exists(stream));
  writeEvent(stream);
  streamAdmin.getConfig(stream);
  streamAdmin.getProperties(stream);
  revokeAndAssertSuccess(new NamespaceId(FOO_NAMESPACE),USER,ImmutableSet.of(Action.WRITE));
  revokeAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.ALL));
  streamAdmin.getConfig(stream);
  try {
    streamAdmin.getProperties(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.READ));
  streamAdmin.getConfig(stream);
  StreamProperties properties=streamAdmin.getProperties(stream);
  try {
    streamAdmin.updateConfig(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  writeEvent(stream);
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  writeEvent(stream);
  try {
    streamAdmin.updateConfig(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  try {
    streamAdmin.truncate(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  try {
    streamAdmin.drop(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.ADMIN));
  streamAdmin.updateConfig(stream,properties);
  streamAdmin.truncate(stream);
  Assert.assertEquals(0,getStreamSize(stream));
  streamAdmin.drop(stream);
}

Fixed version (ground truth):
@Test public void testConfigAndTruncate() throws Exception {
  StreamAdmin streamAdmin=getStreamAdmin();
  grantAndAssertSuccess(new NamespaceId(FOO_NAMESPACE),USER,ImmutableSet.of(Action.WRITE));
  Id.Stream stream=Id.Stream.from(FOO_NAMESPACE,"String_Node_Str");
  streamAdmin.create(stream);
  Assert.assertTrue(streamAdmin.exists(stream));
  writeEvent(stream);
  streamAdmin.getConfig(stream);
  streamAdmin.getProperties(stream);
  revokeAndAssertSuccess(new NamespaceId(FOO_NAMESPACE),USER,ImmutableSet.of(Action.WRITE));
  revokeAndAssertSuccess(stream.toEntityId(),USER,EnumSet.allOf(Action.class));
  streamAdmin.getConfig(stream);
  try {
    streamAdmin.getProperties(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.READ));
  streamAdmin.getConfig(stream);
  StreamProperties properties=streamAdmin.getProperties(stream);
  try {
    streamAdmin.updateConfig(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  writeEvent(stream);
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.WRITE));
  writeEvent(stream);
  try {
    streamAdmin.updateConfig(stream,properties);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  try {
    streamAdmin.truncate(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  try {
    streamAdmin.drop(stream);
    Assert.fail("String_Node_Str");
  }
 catch (  UnauthorizedException e) {
  }
  grantAndAssertSuccess(stream.toEntityId(),USER,ImmutableSet.of(Action.ADMIN));
  streamAdmin.updateConfig(stream,properties);
  streamAdmin.truncate(stream);
  Assert.assertEquals(0,getStreamSize(stream));
  streamAdmin.drop(stream);
}