Program: 33943
Project: 33943
Buggy source:
@Test(groups={"String_Node_Str"},dependsOnGroups={"String_Node_Str"}) public void associatedTest() throws Exception {
  String uniqueId="String_Node_Str";
{
{
      LMDoc.Builder indexedDocBuilder=LMDoc.newBuilder();
      indexedDocBuilder.setIndexName(MY_TEST_INDEX);
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      DBObject dbObject=new BasicDBObject();
      dbObject.put("String_Node_Str","String_Node_Str");
      dbObject.put("String_Node_Str","String_Node_Str");
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(true);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.setResultDocument(dbObject);
      s.addAssociatedDocument(ad);
      lumongoWorkPool.execute(s);
    }
{
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(false);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.addAssociatedDocument(ad);
      lumongoWorkPool.execute(s);
    }
{
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(true);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.addAssociatedDocument(ad);
    }
  }
{
{
      FetchResult response=lumongoWorkPool.execute(new FetchDocumentAndAssociated(uniqueId,true));
      Assert.assertTrue(response.hasResultDocument(),"String_Node_Str" + uniqueId + "String_Node_Str");
      ResultDocument rd=response.getResultDocument();
      DBObject dbObject=BsonHelper.dbObjectFromResultDocument(rd);
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(response.getAssociatedDocumentCount(),3,"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(0).hasDocument(),"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(1).hasDocument(),"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(2).hasDocument(),"String_Node_Str");
    }
{
      FetchResult response=lumongoWorkPool.execute(new FetchDocumentAndAssociated(uniqueId));
      Assert.assertTrue(response.hasResultDocument(),"String_Node_Str" + uniqueId + "String_Node_Str");
      ResultDocument rd=response.getResultDocument();
      DBObject dbObject=BsonHelper.dbObjectFromResultDocument(rd);
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(response.getAssociatedDocumentCount(),3,"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(0).hasDocument(),"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(1).hasDocument(),"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(2).hasDocument(),"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},dependsOnGroups={"String_Node_Str"}) public void associatedTest() throws Exception {
  String uniqueId="String_Node_Str";
{
{
      LMDoc.Builder indexedDocBuilder=LMDoc.newBuilder();
      indexedDocBuilder.setIndexName(MY_TEST_INDEX);
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      indexedDocBuilder.addIndexedField(LMField.newBuilder().setFieldName("String_Node_Str").addFieldValue("String_Node_Str").build());
      LMDoc indexedDoc=indexedDocBuilder.build();
      DBObject dbObject=new BasicDBObject();
      dbObject.put("String_Node_Str","String_Node_Str");
      dbObject.put("String_Node_Str","String_Node_Str");
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(true);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.addIndexedDocument(indexedDoc);
      s.setResultDocument(dbObject);
      s.addAssociatedDocument(ad);
      lumongoWorkPool.execute(s);
    }
{
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(false);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.addAssociatedDocument(ad);
      lumongoWorkPool.execute(s);
    }
{
      AssociatedDocument.Builder adBuilder=AssociatedDocument.newBuilder();
      adBuilder.setCompressed(true);
      adBuilder.setDocument(ByteString.copyFromUtf8("String_Node_Str"));
      adBuilder.addMetadata(Metadata.newBuilder().setKey("String_Node_Str").setValue("String_Node_Str"));
      adBuilder.setFilename("String_Node_Str");
      adBuilder.setDocumentUniqueId(uniqueId);
      AssociatedDocument ad=adBuilder.build();
      Store s=new Store(uniqueId);
      s.addAssociatedDocument(ad);
      lumongoWorkPool.execute(s);
    }
  }
{
{
      FetchResult response=lumongoWorkPool.execute(new FetchDocumentAndAssociated(uniqueId,true));
      Assert.assertTrue(response.hasResultDocument(),"String_Node_Str" + uniqueId + "String_Node_Str");
      ResultDocument rd=response.getResultDocument();
      DBObject dbObject=BsonHelper.dbObjectFromResultDocument(rd);
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(response.getAssociatedDocumentCount(),3,"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(0).hasDocument(),"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(1).hasDocument(),"String_Node_Str");
      Assert.assertTrue(!response.getAssociatedDocuments().get(2).hasDocument(),"String_Node_Str");
    }
{
      FetchResult response=lumongoWorkPool.execute(new FetchDocumentAndAssociated(uniqueId));
      Assert.assertTrue(response.hasResultDocument(),"String_Node_Str" + uniqueId + "String_Node_Str");
      ResultDocument rd=response.getResultDocument();
      DBObject dbObject=BsonHelper.dbObjectFromResultDocument(rd);
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(dbObject.get("String_Node_Str"),"String_Node_Str","String_Node_Str");
      Assert.assertEquals(response.getAssociatedDocumentCount(),3,"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(0).hasDocument(),"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(1).hasDocument(),"String_Node_Str");
      Assert.assertTrue(response.getAssociatedDocuments().get(2).hasDocument(),"String_Node_Str");
    }
  }
}