Program: 6853
Project: 6853
Buggy source:
@Test public void testGetArtifacts() throws Exception {
  Id.Artifact artifact1V1=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  String contents1V1="String_Node_Str";
  List<PluginClass> plugins1V1=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  ArtifactMeta meta1V1=new ArtifactMeta(plugins1V1);
  artifactStore.write(artifact1V1,meta1V1,new ByteArrayInputStream(Bytes.toBytes(contents1V1)));
  Id.Artifact artifact2V1=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  Id.Artifact artifact2V2=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  String contents2V1="String_Node_Str";
  String contents2V2="String_Node_Str";
  List<PluginClass> plugins2V1=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  List<PluginClass> plugins2V2=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  ArtifactMeta meta2V1=new ArtifactMeta(plugins2V1);
  ArtifactMeta meta2V2=new ArtifactMeta(plugins2V2);
  artifactStore.write(artifact2V1,meta2V1,new ByteArrayInputStream(Bytes.toBytes(contents2V1)));
  artifactStore.write(artifact2V2,meta2V2,new ByteArrayInputStream(Bytes.toBytes(contents2V2)));
  List<ArtifactDetail> artifact1Versions=artifactStore.getArtifacts(artifact1V1.getNamespace(),artifact1V1.getName());
  Assert.assertEquals(1,artifact1Versions.size());
  assertEqual(artifact1V1,meta1V1,contents1V1,artifact1Versions.get(0));
  List<ArtifactDetail> artifact2Versions=artifactStore.getArtifacts(artifact2V1.getNamespace(),artifact2V1.getName());
  Assert.assertEquals(2,artifact2Versions.size());
  assertEqual(artifact2V1,meta2V1,contents2V1,artifact2Versions.get(0));
  assertEqual(artifact2V2,meta2V2,contents2V2,artifact2Versions.get(1));
  List<ArtifactDetail> artifactVersions=artifactStore.getArtifacts(Constants.DEFAULT_NAMESPACE_ID);
  Assert.assertEquals(3,artifactVersions.size());
  assertEqual(artifact1V1,meta1V1,contents1V1,artifactVersions.get(0));
  assertEqual(artifact2V1,meta2V1,contents2V1,artifactVersions.get(1));
  assertEqual(artifact2V2,meta2V2,contents2V2,artifactVersions.get(2));
}

Fixed version (ground truth):
@Test public void testGetArtifacts() throws Exception {
  Id.Artifact artifact1V1=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  String contents1V1="String_Node_Str";
  List<PluginClass> plugins1V1=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  ArtifactMeta meta1V1=new ArtifactMeta(plugins1V1);
  artifactStore.write(artifact1V1,meta1V1,new ByteArrayInputStream(Bytes.toBytes(contents1V1)));
  Id.Artifact artifact2V1=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  Id.Artifact artifact2V2=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  String contents2V1="String_Node_Str";
  String contents2V2="String_Node_Str";
  List<PluginClass> plugins2V1=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  List<PluginClass> plugins2V2=ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of()));
  ArtifactMeta meta2V1=new ArtifactMeta(plugins2V1);
  ArtifactMeta meta2V2=new ArtifactMeta(plugins2V2);
  artifactStore.write(artifact2V1,meta2V1,new ByteArrayInputStream(Bytes.toBytes(contents2V1)));
  artifactStore.write(artifact2V2,meta2V2,new ByteArrayInputStream(Bytes.toBytes(contents2V2)));
  List<ArtifactDetail> artifact1Versions=artifactStore.getArtifacts(artifact1V1.getNamespace(),artifact1V1.getName());
  Assert.assertEquals(1,artifact1Versions.size());
  assertEqual(artifact1V1,meta1V1,contents1V1,artifact1Versions.get(0));
  List<ArtifactDetail> artifact2Versions=artifactStore.getArtifacts(artifact2V1.getNamespace(),artifact2V1.getName());
  Assert.assertEquals(2,artifact2Versions.size());
  assertEqual(artifact2V1,meta2V1,contents2V1,artifact2Versions.get(0));
  assertEqual(artifact2V2,meta2V2,contents2V2,artifact2Versions.get(1));
  List<ArtifactDetail> artifactVersions=artifactStore.getArtifacts(Constants.DEFAULT_NAMESPACE_ID);
  Assert.assertEquals(3,artifactVersions.size());
  assertEqual(artifact1V1,meta1V1,contents1V1,artifactVersions.get(0));
  assertEqual(artifact2V1,meta2V1,contents2V1,artifactVersions.get(1));
  assertEqual(artifact2V2,meta2V2,contents2V2,artifactVersions.get(2));
  ArtifactRange range=new ArtifactRange(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str"));
  artifactVersions=artifactStore.getArtifacts(range);
  Assert.assertEquals(2,artifactVersions.size());
  assertEqual(artifact2V1,meta2V1,contents2V1,artifactVersions.get(0));
  assertEqual(artifact2V2,meta2V2,contents2V2,artifactVersions.get(1));
  range=new ArtifactRange(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str"));
  artifactVersions=artifactStore.getArtifacts(range);
  Assert.assertEquals(1,artifactVersions.size());
  assertEqual(artifact2V2,meta2V2,contents2V2,artifactVersions.get(0));
  range=new ArtifactRange(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str"));
  artifactVersions=artifactStore.getArtifacts(range);
  Assert.assertEquals(1,artifactVersions.size());
  assertEqual(artifact2V1,meta2V1,contents2V1,artifactVersions.get(0));
}