Program: 4756
Project: 4756
Buggy source:
@Test public void testPartitionMetadata() throws Exception {
  final TimePartitionedFileSet tpfs=dsFrameworkUtil.getInstance(TPFS_INSTANCE);
  TransactionAware txAware=(TransactionAware)tpfs;
  dsFrameworkUtil.newInMemoryTransactionExecutor(txAware).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      validateTimePartitions(tpfs,0L,MAX,Collections.<Long,String>emptyMap());
      Date date=DATE_FORMAT.parse("String_Node_Str");
      long time=date.getTime();
      Map<String,String> allMetadata=Maps.newHashMap();
      Map<String,String> metadata=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      tpfs.addPartition(time,"String_Node_Str",metadata);
      allMetadata.putAll(metadata);
      TimePartitionDetail partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(metadata,partitionByTime.getMetadata().asMap());
      tpfs.addMetadata(time,"String_Node_Str","String_Node_Str");
      allMetadata.put("String_Node_Str","String_Node_Str");
      tpfs.addMetadata(time,"String_Node_Str","String_Node_Str");
      allMetadata.put("String_Node_Str","String_Node_Str");
      Map<String,String> newMetadata=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      tpfs.addMetadata(time,newMetadata);
      allMetadata.putAll(newMetadata);
      partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(allMetadata,partitionByTime.getMetadata().asMap());
      tpfs.removeMetadata(time,ImmutableSet.of("String_Node_Str","String_Node_Str","String_Node_Str"));
      allMetadata.remove("String_Node_Str");
      allMetadata.remove("String_Node_Str");
      partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(allMetadata,partitionByTime.getMetadata().asMap());
    }
  }
);
}

Fixed version (ground truth):
@Test public void testPartitionMetadata() throws Exception {
  final TimePartitionedFileSet tpfs=dsFrameworkUtil.getInstance(TPFS_INSTANCE);
  TransactionAware txAware=(TransactionAware)tpfs;
  dsFrameworkUtil.newInMemoryTransactionExecutor(txAware).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      validateTimePartitions(tpfs,0L,MAX,Collections.<Long,String>emptyMap());
      Date date=DATE_FORMAT.parse("String_Node_Str");
      long time=date.getTime();
      Map<String,String> allMetadata=Maps.newHashMap();
      Map<String,String> metadata=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      tpfs.addPartition(time,"String_Node_Str",metadata);
      allMetadata.putAll(metadata);
      TimePartitionDetail partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(metadata,partitionByTime.getMetadata().asMap());
      tpfs.addMetadata(time,"String_Node_Str","String_Node_Str");
      allMetadata.put("String_Node_Str","String_Node_Str");
      tpfs.setMetadata(time,Collections.singletonMap("String_Node_Str","String_Node_Str"));
      allMetadata.put("String_Node_Str","String_Node_Str");
      Map<String,String> newMetadata=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      tpfs.addMetadata(time,newMetadata);
      allMetadata.putAll(newMetadata);
      try {
        tpfs.addMetadata(time,"String_Node_Str","String_Node_Str");
        Assert.fail("String_Node_Str");
      }
 catch (      DataSetException expected) {
      }
      partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(allMetadata,partitionByTime.getMetadata().asMap());
      tpfs.removeMetadata(time,ImmutableSet.of("String_Node_Str","String_Node_Str","String_Node_Str"));
      allMetadata.remove("String_Node_Str");
      allMetadata.remove("String_Node_Str");
      partitionByTime=tpfs.getPartitionByTime(time);
      Assert.assertNotNull(partitionByTime);
      Assert.assertEquals(allMetadata,partitionByTime.getMetadata().asMap());
    }
  }
);
}