Program: 6631
Project: 6631
Buggy source:
@Test public void testTags() throws IOException {
  Assert.assertEquals(400,addTags(application).getResponseCode());
  Set<String> appTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(application,appTags).getResponseCode());
  Assert.assertEquals(400,addTags(pingService).getResponseCode());
  Set<String> serviceTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(pingService,serviceTags).getResponseCode());
  Assert.assertEquals(400,addTags(myds).getResponseCode());
  Set<String> datasetTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(myds,datasetTags).getResponseCode());
  Assert.assertEquals(400,addTags(mystream).getResponseCode());
  Set<String> streamTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(mystream,streamTags).getResponseCode());
  Set<String> tags=getTags(application);
  Assert.assertTrue(tags.containsAll(appTags));
  Assert.assertTrue(appTags.containsAll(tags));
  tags=getTags(pingService);
  Assert.assertTrue(tags.containsAll(serviceTags));
  Assert.assertTrue(serviceTags.containsAll(tags));
  tags=getTags(myds);
  Assert.assertTrue(tags.containsAll(datasetTags));
  Assert.assertTrue(datasetTags.containsAll(tags));
  tags=getTags(mystream);
  Assert.assertTrue(tags.containsAll(streamTags));
  Assert.assertTrue(streamTags.containsAll(tags));
  removeTags(application,"String_Node_Str");
  Assert.assertEquals(ImmutableSet.of("String_Node_Str"),getTags(application));
  removeTags(pingService);
  Assert.assertTrue(getTags(pingService).isEmpty());
  removeTags(pingService);
  Assert.assertTrue(getTags(pingService).isEmpty());
  removeTags(myds,"String_Node_Str");
  Assert.assertEquals(ImmutableSet.of("String_Node_Str"),getTags(myds));
  removeTags(mystream,"String_Node_Str");
  removeTags(mystream,"String_Node_Str");
  Assert.assertTrue(getTags(mystream).isEmpty());
  removeTags(application);
  removeTags(pingService);
  removeTags(myds);
  removeTags(mystream);
  Assert.assertTrue(getTags(application).isEmpty());
  Assert.assertTrue(getTags(pingService).isEmpty());
  Assert.assertTrue(getTags(myds).isEmpty());
  Assert.assertTrue(getTags(mystream).isEmpty());
  Assert.assertEquals(404,addTags(nonExistingApp,appTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingService,serviceTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingDataset,datasetTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingStream,streamTags).getResponseCode());
}

Fixed version (ground truth):
@Test public void testTags() throws IOException {
  Assert.assertEquals(400,addTags(application).getResponseCode());
  Set<String> appTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(application,appTags).getResponseCode());
  Assert.assertEquals(400,addTags(pingService).getResponseCode());
  Set<String> serviceTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(pingService,serviceTags).getResponseCode());
  Assert.assertEquals(400,addTags(myds).getResponseCode());
  Set<String> datasetTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(myds,datasetTags).getResponseCode());
  Assert.assertEquals(400,addTags(mystream).getResponseCode());
  Set<String> streamTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
  Assert.assertEquals(200,addTags(mystream,streamTags).getResponseCode());
  Set<String> tags=getTags(application);
  Assert.assertTrue(tags.containsAll(appTags));
  Assert.assertTrue(appTags.containsAll(tags));
  tags=getTags(pingService);
  Assert.assertTrue(tags.containsAll(serviceTags));
  Assert.assertTrue(serviceTags.containsAll(tags));
  tags=getTags(myds);
  Assert.assertTrue(tags.containsAll(datasetTags));
  Assert.assertTrue(datasetTags.containsAll(tags));
  tags=getTags(mystream);
  Assert.assertTrue(tags.containsAll(streamTags));
  Assert.assertTrue(streamTags.containsAll(tags));
  Set<MetadataSearchResultRecord> searchTags=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  Set<MetadataSearchResultRecord> expected=ImmutableSet.of(new MetadataSearchResultRecord(mystream,MetadataSearchTargetType.STREAM));
  Assert.assertEquals(expected,searchTags);
  searchTags=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str","String_Node_Str");
  expected=ImmutableSet.of(new MetadataSearchResultRecord(mystream,MetadataSearchTargetType.STREAM),new MetadataSearchResultRecord(pingService,MetadataSearchTargetType.PROGRAM));
  Assert.assertEquals(expected,searchTags);
  searchTags=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(expected,searchTags);
  searchTags=searchMetadata(Id.Namespace.DEFAULT.getId(),"String_Node_Str",null);
  Assert.assertEquals(ImmutableSet.of(),searchTags);
  removeTags(application,"String_Node_Str");
  Assert.assertEquals(ImmutableSet.of("String_Node_Str"),getTags(application));
  removeTags(pingService);
  Assert.assertTrue(getTags(pingService).isEmpty());
  removeTags(pingService);
  Assert.assertTrue(getTags(pingService).isEmpty());
  removeTags(myds,"String_Node_Str");
  Assert.assertEquals(ImmutableSet.of("String_Node_Str"),getTags(myds));
  removeTags(mystream,"String_Node_Str");
  removeTags(mystream,"String_Node_Str");
  Assert.assertTrue(getTags(mystream).isEmpty());
  removeTags(application);
  removeTags(pingService);
  removeTags(myds);
  removeTags(mystream);
  Assert.assertTrue(getTags(application).isEmpty());
  Assert.assertTrue(getTags(pingService).isEmpty());
  Assert.assertTrue(getTags(myds).isEmpty());
  Assert.assertTrue(getTags(mystream).isEmpty());
  Assert.assertEquals(404,addTags(nonExistingApp,appTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingService,serviceTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingDataset,datasetTags).getResponseCode());
  Assert.assertEquals(404,addTags(nonExistingStream,streamTags).getResponseCode());
}