Program: 6502
Project: 6502
Buggy source:
@Test public void testMetadata() throws IOException {
  assertCleanState();
  removeAllMetadata();
  assertCleanState();
  Map<String,String> appProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> serviceProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> streamProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Set<String> appTags=ImmutableSet.of("String_Node_Str");
  Set<String> serviceTags=ImmutableSet.of("String_Node_Str");
  Set<String> datasetTags=ImmutableSet.of("String_Node_Str");
  Set<String> streamTags=ImmutableSet.of("String_Node_Str");
  Assert.assertEquals(200,addProperties(application,appProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(pingService,serviceProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(myds,datasetProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(mystream,streamProperties).getResponseCode());
  Assert.assertEquals(200,addTags(application,appTags).getResponseCode());
  Assert.assertEquals(200,addTags(pingService,serviceTags).getResponseCode());
  Assert.assertEquals(200,addTags(myds,datasetTags).getResponseCode());
  Assert.assertEquals(200,addTags(mystream,streamTags).getResponseCode());
  Set<MetadataRecord> metadataRecords=getMetadata(application);
  Assert.assertEquals(1,metadataRecords.size());
  MetadataRecord metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(application,metadata.getTargetId());
  Assert.assertEquals(appProperties,metadata.getProperties());
  Assert.assertEquals(appTags,metadata.getTags());
  metadataRecords=getMetadata(pingService);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(pingService,metadata.getTargetId());
  Assert.assertEquals(serviceProperties,metadata.getProperties());
  Assert.assertEquals(serviceTags,metadata.getTags());
  metadataRecords=getMetadata(myds);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(myds,metadata.getTargetId());
  Assert.assertEquals(datasetProperties,metadata.getProperties());
  Assert.assertEquals(datasetTags,metadata.getTags());
  metadataRecords=getMetadata(mystream);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(mystream,metadata.getTargetId());
  Assert.assertEquals(streamProperties,metadata.getProperties());
  Assert.assertEquals(streamTags,metadata.getTags());
  removeAllMetadata();
  assertCleanState();
}

Fixed version (ground truth):
@Test public void testMetadata() throws IOException {
  assertCleanState();
  removeAllMetadata();
  assertCleanState();
  Map<String,String> appProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> serviceProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Map<String,String> streamProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
  Set<String> appTags=ImmutableSet.of("String_Node_Str");
  Set<String> serviceTags=ImmutableSet.of("String_Node_Str");
  Set<String> datasetTags=ImmutableSet.of("String_Node_Str");
  Set<String> streamTags=ImmutableSet.of("String_Node_Str");
  Assert.assertEquals(200,addProperties(application,appProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(pingService,serviceProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(myds,datasetProperties).getResponseCode());
  Assert.assertEquals(200,addProperties(mystream,streamProperties).getResponseCode());
  Assert.assertEquals(200,addTags(application,appTags).getResponseCode());
  Assert.assertEquals(200,addTags(pingService,serviceTags).getResponseCode());
  Assert.assertEquals(200,addTags(myds,datasetTags).getResponseCode());
  Assert.assertEquals(200,addTags(mystream,streamTags).getResponseCode());
  Set<MetadataRecord> metadataRecords=getMetadata(application);
  Assert.assertEquals(1,metadataRecords.size());
  MetadataRecord metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(application,metadata.getEntityId());
  Assert.assertEquals(appProperties,metadata.getProperties());
  Assert.assertEquals(appTags,metadata.getTags());
  metadataRecords=getMetadata(pingService);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(pingService,metadata.getEntityId());
  Assert.assertEquals(serviceProperties,metadata.getProperties());
  Assert.assertEquals(serviceTags,metadata.getTags());
  metadataRecords=getMetadata(myds);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(myds,metadata.getEntityId());
  Assert.assertEquals(datasetProperties,metadata.getProperties());
  Assert.assertEquals(datasetTags,metadata.getTags());
  metadataRecords=getMetadata(mystream);
  Assert.assertEquals(1,metadataRecords.size());
  metadata=metadataRecords.iterator().next();
  Assert.assertEquals(MetadataScope.USER,metadata.getScope());
  Assert.assertEquals(mystream,metadata.getEntityId());
  Assert.assertEquals(streamProperties,metadata.getProperties());
  Assert.assertEquals(streamTags,metadata.getTags());
  removeAllMetadata();
  assertCleanState();
}