Program: 4542
Project: 4542
Buggy source:
@Test public void testTags() throws InterruptedException, TransactionFailureException {
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getTags(app1).size());
    Assert.assertEquals(0,dataset.getTags(flow1).size());
    Assert.assertEquals(0,dataset.getTags(dataset1).size());
    Assert.assertEquals(0,dataset.getTags(stream1).size());
    Assert.assertEquals(0,dataset.getTags(view1).size());
    Assert.assertEquals(0,dataset.getTags(artifact1).size());
    Assert.assertEquals(0,dataset.getTags(fileEntity).size());
    Assert.assertEquals(0,dataset.getTags(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getTags(jarEntity).size());
  }
);
  txnl.execute(() -> {
    dataset.addTags(app1,"String_Node_Str","String_Node_Str","String_Node_Str");
    dataset.addTags(flow1,"String_Node_Str");
    dataset.addTags(dataset1,"String_Node_Str","String_Node_Str");
    dataset.addTags(stream1,"String_Node_Str");
    dataset.addTags(view1,"String_Node_Str");
    dataset.addTags(artifact1,"String_Node_Str");
    dataset.addTags(fileEntity,"String_Node_Str");
    dataset.addTags(partitionFileEntity,"String_Node_Str");
    dataset.addTags(jarEntity,"String_Node_Str","String_Node_Str");
  }
);
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(3,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(3,dataset.getTags(app1).size());
    dataset.addTags(app1,"String_Node_Str");
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(3,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.addTags(app1,"String_Node_Str"));
  txnl.execute(() -> {
    Assert.assertEquals(3,dataset.getTags(app1).size());
    Set<String> tags=dataset.getTags(flow1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(dataset1);
    Assert.assertEquals(2,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(stream1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(view1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(fileEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(partitionFileEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(jarEntity);
    Assert.assertEquals(2,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeTags(app1,"String_Node_Str","String_Node_Str"));
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeTags(dataset1,"String_Node_Str"));
  txnl.execute(() -> dataset.removeTags(jarEntity,"String_Node_Str"));
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(dataset1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(artifact1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(jarEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> {
    dataset.removeTags(app1);
    dataset.removeTags(flow1);
    dataset.removeTags(dataset1);
    dataset.removeTags(stream1);
    dataset.removeTags(view1);
    dataset.removeTags(artifact1);
    dataset.removeTags(fileEntity);
    dataset.removeTags(partitionFileEntity);
    dataset.removeTags(jarEntity);
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getTags(app1).size());
    Assert.assertEquals(0,dataset.getTags(flow1).size());
    Assert.assertEquals(0,dataset.getTags(dataset1).size());
    Assert.assertEquals(0,dataset.getTags(stream1).size());
    Assert.assertEquals(0,dataset.getTags(view1).size());
    Assert.assertEquals(0,dataset.getTags(artifact1).size());
    Assert.assertEquals(0,dataset.getTags(fileEntity).size());
    Assert.assertEquals(0,dataset.getTags(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getTags(jarEntity).size());
  }
);
}

Fixed version (ground truth):
@Test public void testTags() throws InterruptedException, TransactionFailureException {
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getTags(app1).size());
    Assert.assertEquals(0,dataset.getTags(flow1).size());
    Assert.assertEquals(0,dataset.getTags(dataset1).size());
    Assert.assertEquals(0,dataset.getTags(stream1).size());
    Assert.assertEquals(0,dataset.getTags(view1).size());
    Assert.assertEquals(0,dataset.getTags(artifact1).size());
    Assert.assertEquals(0,dataset.getTags(fileEntity).size());
    Assert.assertEquals(0,dataset.getTags(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getTags(jarEntity).size());
  }
);
  txnl.execute(() -> {
    dataset.addTags(app1,"String_Node_Str","String_Node_Str","String_Node_Str");
    MetadataChange metadataChange=dataset.addTags(flow1,Collections.emptySet());
    Assert.assertEquals(metadataChange.getExisting(),new Metadata(flow1,Collections.emptyMap(),Collections.emptySet()));
    Assert.assertEquals(metadataChange.getLatest(),new Metadata(flow1,Collections.emptyMap(),Collections.emptySet()));
    metadataChange=dataset.addTags(flow1,"String_Node_Str");
    Assert.assertEquals(new Metadata(flow1),metadataChange.getExisting());
    Assert.assertEquals(new Metadata(flow1,Collections.emptyMap(),ImmutableSet.of("String_Node_Str")),metadataChange.getLatest());
    metadataChange=dataset.addTags(flow1,"String_Node_Str");
    Assert.assertEquals(new Metadata(flow1,Collections.emptyMap(),ImmutableSet.of("String_Node_Str")),metadataChange.getExisting());
    Assert.assertEquals(new Metadata(flow1,Collections.emptyMap(),ImmutableSet.of("String_Node_Str","String_Node_Str")),metadataChange.getLatest());
    dataset.addTags(dataset1,"String_Node_Str","String_Node_Str");
    dataset.addTags(stream1,"String_Node_Str");
    dataset.addTags(view1,"String_Node_Str");
    dataset.addTags(artifact1,"String_Node_Str");
    dataset.addTags(fileEntity,"String_Node_Str");
    dataset.addTags(partitionFileEntity,"String_Node_Str");
    dataset.addTags(jarEntity,"String_Node_Str","String_Node_Str");
  }
);
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(3,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(3,dataset.getTags(app1).size());
    dataset.addTags(app1,"String_Node_Str");
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(3,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.addTags(app1,"String_Node_Str"));
  txnl.execute(() -> {
    Assert.assertEquals(3,dataset.getTags(app1).size());
    Set<String> tags=dataset.getTags(flow1);
    Assert.assertEquals(2,tags.size());
    Assert.assertTrue(tags.containsAll(ImmutableSet.of("String_Node_Str","String_Node_Str")));
    tags=dataset.getTags(dataset1);
    Assert.assertEquals(2,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(stream1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(view1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(fileEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(partitionFileEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(jarEntity);
    Assert.assertEquals(2,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeTags(app1,"String_Node_Str","String_Node_Str"));
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(app1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeTags(dataset1,"String_Node_Str"));
  txnl.execute(() -> dataset.removeTags(jarEntity,"String_Node_Str"));
  txnl.execute(() -> {
    Set<String> tags=dataset.getTags(dataset1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(artifact1);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
    tags=dataset.getTags(jarEntity);
    Assert.assertEquals(1,tags.size());
    Assert.assertTrue(tags.contains("String_Node_Str"));
  }
);
  txnl.execute(() -> {
    dataset.removeTags(app1);
    dataset.removeTags(flow1);
    dataset.removeTags(dataset1);
    dataset.removeTags(stream1);
    dataset.removeTags(view1);
    dataset.removeTags(artifact1);
    dataset.removeTags(fileEntity);
    dataset.removeTags(partitionFileEntity);
    dataset.removeTags(jarEntity);
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getTags(app1).size());
    Assert.assertEquals(0,dataset.getTags(flow1).size());
    Assert.assertEquals(0,dataset.getTags(dataset1).size());
    Assert.assertEquals(0,dataset.getTags(stream1).size());
    Assert.assertEquals(0,dataset.getTags(view1).size());
    Assert.assertEquals(0,dataset.getTags(artifact1).size());
    Assert.assertEquals(0,dataset.getTags(fileEntity).size());
    Assert.assertEquals(0,dataset.getTags(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getTags(jarEntity).size());
  }
);
}