Program: 6504
Project: 6504
Buggy source:
@Test public void testProperties() throws IOException {
  Assert.assertEquals(400,addProperties(application).getResponseCode());
  Map<String,String> appProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(application,appProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(pingService).getResponseCode());
  Map<String,String> serviceProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(pingService,serviceProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(myds).getResponseCode());
  Map<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(myds,datasetProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(mystream).getResponseCode());
  Map<String,String> streamProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(mystream,streamProperties).getResponseCode());
  Map<String,String> properties=getProperties(application);
  Assert.assertEquals(appProperties,properties);
  properties=getProperties(pingService);
  Assert.assertEquals(serviceProperties,properties);
  properties=getProperties(myds);
  Assert.assertEquals(datasetProperties,properties);
  properties=getProperties(mystream);
  Assert.assertEquals(streamProperties,properties);
  Set<MetadataSearchResultRecord> searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  Set<MetadataSearchResultRecord> expected=ImmutableSet.of(new MetadataSearchResultRecord(mystream,MetadataSearchTargetType.STREAM));
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  expected=ImmutableSet.of(new MetadataSearchResultRecord(pingService,MetadataSearchTargetType.PROGRAM));
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertTrue(searchProperties.size() == 0);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertTrue(searchProperties.size() == 0);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(ImmutableSet.<MetadataSearchResultRecord>of(),searchProperties);
  searchProperties=searchMetadata("String_Node_Str","String_Node_Str",null);
  Assert.assertEquals(ImmutableSet.of(),searchProperties);
  removeProperties(application);
  Assert.assertTrue(getProperties(application).isEmpty());
  removeProperties(pingService,"String_Node_Str");
  removeProperties(pingService,"String_Node_Str");
  Assert.assertTrue(getProperties(pingService).isEmpty());
  removeProperties(myds,"String_Node_Str");
  Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),getProperties(myds));
  removeProperties(mystream,"String_Node_Str");
  Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),getProperties(mystream));
  removeProperties(application);
  removeProperties(pingService);
  removeProperties(myds);
  removeProperties(mystream);
  Assert.assertTrue(getProperties(application).isEmpty());
  Assert.assertTrue(getProperties(pingService).isEmpty());
  Assert.assertTrue(getProperties(myds).isEmpty());
  Assert.assertTrue(getProperties(mystream).isEmpty());
  Assert.assertEquals(404,addProperties(nonExistingApp,appProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingService,serviceProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingDataset,datasetProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingStream,streamProperties).getResponseCode());
}

Fixed version (ground truth):
@Test public void testProperties() throws IOException {
  Assert.assertEquals(400,addProperties(application).getResponseCode());
  Map<String,String> appProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(application,appProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(pingService).getResponseCode());
  Map<String,String> serviceProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(pingService,serviceProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(myds).getResponseCode());
  Map<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(myds,datasetProperties).getResponseCode());
  Assert.assertEquals(400,addProperties(mystream).getResponseCode());
  Map<String,String> streamProperties=ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addProperties(mystream,streamProperties).getResponseCode());
  Map<String,String> properties=getProperties(application);
  Assert.assertEquals(appProperties,properties);
  properties=getProperties(pingService);
  Assert.assertEquals(serviceProperties,properties);
  properties=getProperties(myds);
  Assert.assertEquals(datasetProperties,properties);
  properties=getProperties(mystream);
  Assert.assertEquals(streamProperties,properties);
  Set<MetadataSearchResultRecord> searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  Set<MetadataSearchResultRecord> expected=ImmutableSet.of(new MetadataSearchResultRecord(mystream));
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  expected=ImmutableSet.of(new MetadataSearchResultRecord(pingService));
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(expected,searchProperties);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertTrue(searchProperties.size() == 0);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertTrue(searchProperties.size() == 0);
  searchProperties=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(ImmutableSet.<MetadataSearchResultRecord>of(),searchProperties);
  searchProperties=searchMetadata("String_Node_Str","String_Node_Str",null);
  Assert.assertEquals(ImmutableSet.of(),searchProperties);
  removeProperties(application);
  Assert.assertTrue(getProperties(application).isEmpty());
  removeProperties(pingService,"String_Node_Str");
  removeProperties(pingService,"String_Node_Str");
  Assert.assertTrue(getProperties(pingService).isEmpty());
  removeProperties(myds,"String_Node_Str");
  Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),getProperties(myds));
  removeProperties(mystream,"String_Node_Str");
  Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),getProperties(mystream));
  removeProperties(application);
  removeProperties(pingService);
  removeProperties(myds);
  removeProperties(mystream);
  Assert.assertTrue(getProperties(application).isEmpty());
  Assert.assertTrue(getProperties(pingService).isEmpty());
  Assert.assertTrue(getProperties(myds).isEmpty());
  Assert.assertTrue(getProperties(mystream).isEmpty());
  Assert.assertEquals(404,addProperties(nonExistingApp,appProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingService,serviceProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingDataset,datasetProperties).getResponseCode());
  Assert.assertEquals(404,addProperties(nonExistingStream,streamProperties).getResponseCode());
}