Program: 5236
Project: 5236
Buggy source:
@Test public void testSearchDifferentEntityScope() throws InterruptedException, TransactionFailureException {
  final ArtifactId sysArtifact=NamespaceId.SYSTEM.artifact("String_Node_Str","String_Node_Str");
  final ArtifactId nsArtifact=new ArtifactId("String_Node_Str","String_Node_Str","String_Node_Str");
  final String multiWordKey="String_Node_Str";
  final String multiWordValue="String_Node_Str";
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      dataset.setProperty(nsArtifact,multiWordKey,multiWordValue);
      dataset.setProperty(sysArtifact,multiWordKey,multiWordValue);
    }
  }
);
  final MetadataEntry systemArtifactEntry=new MetadataEntry(sysArtifact,multiWordKey,multiWordValue);
  final MetadataEntry nsArtifactEntry=new MetadataEntry(nsArtifact,multiWordKey,multiWordValue);
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      List<MetadataEntry> results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.of(EntityScope.USER)).getResults();
      Assert.assertEquals(Sets.newHashSet(nsArtifactEntry),Sets.newHashSet(results));
      results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.of(EntityScope.SYSTEM)).getResults();
      Assert.assertEquals(Sets.newHashSet(systemArtifactEntry),Sets.newHashSet(results));
      results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.allOf(EntityScope.class)).getResults();
      Assert.assertEquals(Sets.newHashSet(nsArtifactEntry,systemArtifactEntry),Sets.newHashSet(results));
    }
  }
);
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      dataset.removeProperties(nsArtifact);
      dataset.removeProperties(sysArtifact);
    }
  }
);
}

Fixed version (ground truth):
@Test public void testSearchDifferentEntityScope() throws InterruptedException, TransactionFailureException {
  final ArtifactId sysArtifact=NamespaceId.SYSTEM.artifact("String_Node_Str","String_Node_Str");
  final ArtifactId nsArtifact=new ArtifactId("String_Node_Str","String_Node_Str","String_Node_Str");
  final String multiWordKey="String_Node_Str";
  final String multiWordValue="String_Node_Str";
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      dataset.setProperty(nsArtifact,multiWordKey,multiWordValue);
      dataset.setProperty(sysArtifact,multiWordKey,multiWordValue);
    }
  }
);
  final MetadataEntry systemArtifactEntry=new MetadataEntry(sysArtifact,multiWordKey,multiWordValue);
  final MetadataEntry nsArtifactEntry=new MetadataEntry(nsArtifact,multiWordKey,multiWordValue);
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      List<MetadataEntry> results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.of(EntityScope.USER)).getResultsFromOffset();
      Assert.assertEquals(Sets.newHashSet(nsArtifactEntry),Sets.newHashSet(results));
      results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.of(EntityScope.SYSTEM)).getResultsFromOffset();
      Assert.assertEquals(Sets.newHashSet(systemArtifactEntry),Sets.newHashSet(results));
      results=dataset.search("String_Node_Str","String_Node_Str",ImmutableSet.of(EntityTypeSimpleName.ALL),SortInfo.DEFAULT,0,Integer.MAX_VALUE,1,null,false,EnumSet.allOf(EntityScope.class)).getResultsFromOffset();
      Assert.assertEquals(Sets.newHashSet(nsArtifactEntry,systemArtifactEntry),Sets.newHashSet(results));
    }
  }
);
  txnl.execute(new TransactionExecutor.Subroutine(){
    @Override public void apply() throws Exception {
      dataset.removeProperties(nsArtifact);
      dataset.removeProperties(sysArtifact);
    }
  }
);
}