Program: 4755
Project: 4755
Buggy source:
@Test public void testUpdateMetadata() throws Exception {
  final PartitionedFileSet dataset=dsFrameworkUtil.getInstance(pfsInstance);
  dsFrameworkUtil.newTransactionExecutor((TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      PartitionOutput partitionOutput=dataset.getPartitionOutput(PARTITION_KEY);
      ImmutableMap<String,String> originalEntries=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      partitionOutput.setMetadata(originalEntries);
      partitionOutput.addPartition();
      ImmutableMap<String,String> updatedMetadata=ImmutableMap.of("String_Node_Str","String_Node_Str");
      dataset.addMetadata(PARTITION_KEY,updatedMetadata);
      PartitionDetail partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      HashMap<String,String> combinedEntries=Maps.newHashMap();
      combinedEntries.putAll(originalEntries);
      combinedEntries.putAll(updatedMetadata);
      Assert.assertEquals(combinedEntries,partitionDetail.getMetadata().asMap());
      dataset.addMetadata(PARTITION_KEY,"String_Node_Str","String_Node_Str");
      partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),partitionDetail.getMetadata().asMap());
      dataset.removeMetadata(PARTITION_KEY,ImmutableSet.of("String_Node_Str","String_Node_Str","String_Node_Str"));
      partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),partitionDetail.getMetadata().asMap());
      try {
        PartitionKey nonexistentPartitionKey=PartitionKey.builder().addIntField("String_Node_Str",42).addLongField("String_Node_Str",17L).addStringField("String_Node_Str","String_Node_Str").build();
        dataset.addMetadata(nonexistentPartitionKey,"String_Node_Str","String_Node_Str");
        Assert.fail("String_Node_Str");
      }
 catch (      DataSetException expected) {
      }
    }
  }
);
}

Fixed version (ground truth):
@Test public void testUpdateMetadata() throws Exception {
  final PartitionedFileSet dataset=dsFrameworkUtil.getInstance(pfsInstance);
  dsFrameworkUtil.newTransactionExecutor((TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      PartitionOutput partitionOutput=dataset.getPartitionOutput(PARTITION_KEY);
      ImmutableMap<String,String> originalEntries=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
      partitionOutput.setMetadata(originalEntries);
      partitionOutput.addPartition();
      ImmutableMap<String,String> updatedMetadata=ImmutableMap.of("String_Node_Str","String_Node_Str");
      dataset.addMetadata(PARTITION_KEY,updatedMetadata);
      PartitionDetail partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      HashMap<String,String> combinedEntries=Maps.newHashMap();
      combinedEntries.putAll(originalEntries);
      combinedEntries.putAll(updatedMetadata);
      Assert.assertEquals(combinedEntries,partitionDetail.getMetadata().asMap());
      dataset.setMetadata(PARTITION_KEY,Collections.singletonMap("String_Node_Str","String_Node_Str"));
      partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),partitionDetail.getMetadata().asMap());
      try {
        dataset.addMetadata(PARTITION_KEY,"String_Node_Str","String_Node_Str");
        Assert.fail("String_Node_Str");
      }
 catch (      DataSetException expected) {
      }
      dataset.removeMetadata(PARTITION_KEY,ImmutableSet.of("String_Node_Str","String_Node_Str","String_Node_Str"));
      partitionDetail=dataset.getPartition(PARTITION_KEY);
      Assert.assertNotNull(partitionDetail);
      Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),partitionDetail.getMetadata().asMap());
      try {
        PartitionKey nonexistentPartitionKey=PartitionKey.builder().addIntField("String_Node_Str",42).addLongField("String_Node_Str",17L).addStringField("String_Node_Str","String_Node_Str").build();
        dataset.addMetadata(nonexistentPartitionKey,"String_Node_Str","String_Node_Str");
        Assert.fail("String_Node_Str");
      }
 catch (      DataSetException expected) {
      }
    }
  }
);
}