Program: 47894
Project: 47894
Buggy source:
/** 
 * When a record is only included in an index to trigger updates of denormalized data (that is, when vtags=""), then the IndexUpdater shouldn't do any read operations on the repository.
 */
@Test public void testEmptyVtagsDoesNotDoRepositoryRead() throws Exception {
  changeIndexUpdater("String_Node_Str");
  messageVerifier.disable();
  indexUpdaterRepositoryMgr.reset();
  TrackingRepository indexUpdaterRepository=(TrackingRepository)indexUpdaterRepositoryMgr.getRepository(Table.RECORD.name);
  Record record=defaultRepository.newRecord();
  record.setRecordType(vRecordType1.getName());
  record.setField(vfield1.getName(),"String_Node_Str");
  record.setField(vfield2.getName(),"String_Node_Str");
  record.setField(liveTag.getName(),1L);
  record.setField(latestTag.getName(),1L);
  record=defaultRepository.create(record);
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  record.setField(vfield2.getName(),"String_Node_Str");
  record=defaultRepository.update(record);
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  defaultRepository.delete(record.getId());
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  record=defaultRepository.newRecord();
  record.setRecordType(vRecordType1.getName());
  record.setField(vfield2.getName(),"String_Node_Str");
  record.setField(liveTag.getName(),1L);
  record.setField(latestTag.getName(),1L);
  record=defaultRepository.create(record);
  commitIndex();
  assertEquals(1,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",1);
  verifyResultCount("String_Node_Str",1);
}

Fixed version (ground truth):
/** 
 * When a record is only included in an index to trigger updates of denormalized data (that is, when vtags=""), then the IndexUpdater shouldn't do any read operations on the repository.
 */
@Test public void testEmptyVtagsDoesNotDoRepositoryRead() throws Exception {
  changeIndexUpdater("String_Node_Str");
  messageVerifier.disable();
  indexUpdaterRepositoryMgr.reset();
  TrackingRepository indexUpdaterRepository=(TrackingRepository)indexUpdaterRepositoryMgr.getTable(Table.RECORD.name);
  Record record=defaultRepository.newRecord();
  record.setRecordType(vRecordType1.getName());
  record.setField(vfield1.getName(),"String_Node_Str");
  record.setField(vfield2.getName(),"String_Node_Str");
  record.setField(liveTag.getName(),1L);
  record.setField(latestTag.getName(),1L);
  record=defaultRepository.create(record);
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  record.setField(vfield2.getName(),"String_Node_Str");
  record=defaultRepository.update(record);
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  defaultRepository.delete(record.getId());
  commitIndex();
  assertEquals(0,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",0);
  verifyResultCount("String_Node_Str",0);
  record=defaultRepository.newRecord();
  record.setRecordType(vRecordType1.getName());
  record.setField(vfield2.getName(),"String_Node_Str");
  record.setField(liveTag.getName(),1L);
  record.setField(latestTag.getName(),1L);
  record=defaultRepository.create(record);
  commitIndex();
  assertEquals(1,indexUpdaterRepository.reads());
  verifyResultCount("String_Node_Str",1);
  verifyResultCount("String_Node_Str",1);
}