Program: 188391
Project: 188391
Buggy source:
@Test public void testRiskIndex(){
  try {
    Risk risk=new Risk();
    risk.setName("String_Node_Str");
    risk.setDescription("String_Node_Str");
    risk.setIdentifiedOn(new Date());
    risk.setIdentifiedBy("String_Node_Str");
    risk.setCategory("String_Node_Str");
    risk.setNotes("String_Node_Str");
    risk.setPreMitigationProbability(4);
    risk.setPreMitigationImpact(4);
    risk.setPreMitigationSeverity(16);
    risk.setPreMitigationSeverityLevel(SEVERITY_LEVEL.HIGH);
    risk.setPreMitigationNotes("String_Node_Str");
    risk.setPostMitigationProbability(3);
    risk.setPostMitigationImpact(2);
    risk.setPostMitigationSeverity(6);
    risk.setPostMitigationSeverityLevel(SEVERITY_LEVEL.MODERATE);
    risk.setPostMitigationNotes("String_Node_Str");
    risk.setMitigationStrategy("String_Node_Str");
    risk.setMitigationOwnerType("String_Node_Str");
    risk.setMitigationOwner("String_Node_Str");
    risk.setMitigationRelatedEventIdentifierType("String_Node_Str");
    risk.setMitigationRelatedEventIdentifierValue("String_Node_Str");
    risk.setCreatedOn(new Date());
    risk.setCreatedBy("String_Node_Str");
    risk.setUpdatedOn(new Date());
    risk.setUpdatedBy("String_Node_Str");
    model.createRisk(risk,false);
    index.commit(IndexedRisk.class);
    Risk risk2=model.retrieveRisk(risk.getId());
    assertNotNull(risk2);
    assertEquals(risk.getId(),risk2.getId());
    assertEquals(risk.getName(),risk2.getName());
    IndexResult<IndexedRisk> find=index.find(IndexedRisk.class,null,null,new Sublist(0,10),Collections.emptyList());
    assertEquals(1,find.getTotalCount());
    Risk risk3=index.retrieve(IndexedRisk.class,risk.getId(),new ArrayList<>());
    assertNotNull(risk3);
    assertEquals(risk.getId(),risk3.getId());
    assertEquals(risk.getName(),risk3.getName());
    risk3.setName("String_Node_Str");
    Map<String,String> properties=new HashMap<>();
    properties.put(RodaConstants.VERSION_ACTION,RodaConstants.VersionAction.UPDATED.toString());
    model.updateRisk(risk3,properties,false,0);
    Risk risk4=index.retrieve(IndexedRisk.class,risk.getId(),new ArrayList<>());
    assertNotNull(risk4);
    assertEquals(risk.getId(),risk4.getId());
    assertEquals(risk4.getName(),"String_Node_Str");
    model.deleteRisk(risk.getId(),false);
  }
 catch (  GenericException|RequestNotValidException|NotFoundException|AuthorizationDeniedException e) {
    e.printStackTrace();
    assertTrue(false);
  }
}

Fixed version (ground truth):
@Test public void testRiskIndex(){
  try {
    Risk risk=new Risk();
    risk.setName("String_Node_Str");
    risk.setDescription("String_Node_Str");
    risk.setIdentifiedOn(new Date());
    risk.setIdentifiedBy("String_Node_Str");
    risk.setCategory("String_Node_Str");
    risk.setNotes("String_Node_Str");
    risk.setPreMitigationProbability(4);
    risk.setPreMitigationImpact(4);
    risk.setPreMitigationSeverity(16);
    risk.setPreMitigationSeverityLevel(SEVERITY_LEVEL.HIGH);
    risk.setPreMitigationNotes("String_Node_Str");
    risk.setPostMitigationProbability(3);
    risk.setPostMitigationImpact(2);
    risk.setPostMitigationSeverity(6);
    risk.setPostMitigationSeverityLevel(SEVERITY_LEVEL.MODERATE);
    risk.setPostMitigationNotes("String_Node_Str");
    risk.setMitigationStrategy("String_Node_Str");
    risk.setMitigationOwnerType("String_Node_Str");
    risk.setMitigationOwner("String_Node_Str");
    risk.setMitigationRelatedEventIdentifierType("String_Node_Str");
    risk.setMitigationRelatedEventIdentifierValue("String_Node_Str");
    risk.setCreatedOn(new Date());
    risk.setCreatedBy("String_Node_Str");
    risk.setUpdatedOn(new Date());
    risk.setUpdatedBy("String_Node_Str");
    model.createRisk(risk,false);
    index.commit(IndexedRisk.class);
    Risk risk2=model.retrieveRisk(risk.getId());
    assertNotNull(risk2);
    assertEquals(risk.getId(),risk2.getId());
    assertEquals(risk.getName(),risk2.getName());
    IndexResult<IndexedRisk> find=index.find(IndexedRisk.class,null,null,new Sublist(0,10),Collections.emptyList());
    assertEquals(1,find.getTotalCount());
    Risk risk3=index.retrieve(IndexedRisk.class,risk.getId(),new ArrayList<>());
    assertNotNull(risk3);
    assertEquals(risk.getId(),risk3.getId());
    assertEquals(risk.getName(),risk3.getName());
    risk3.setName("String_Node_Str");
    Map<String,String> properties=new HashMap<>();
    properties.put(RodaConstants.VERSION_ACTION,RodaConstants.VersionAction.UPDATED.toString());
    model.updateRisk(risk3,properties,false,0);
    Risk risk4=index.retrieve(IndexedRisk.class,risk.getId(),new ArrayList<>());
    assertNotNull(risk4);
    assertEquals(risk.getId(),risk4.getId());
    assertEquals(risk4.getName(),"String_Node_Str");
    model.deleteRisk(risk.getId(),false);
  }
 catch (  GenericException|RequestNotValidException|NotFoundException|AuthorizationDeniedException e) {
    e.printStackTrace(System.err);
    assertTrue(false);
  }
}