Program: 160319
Project: 160319
Buggy source:
public void testRevTree(){
}

Fixed version (ground truth):
public void testRevTree(){
  CBLRevision rev=new CBLRevision("String_Node_Str","String_Node_Str",false,database);
  Map<String,Object> revProperties=new HashMap<String,Object>();
  revProperties.put("String_Node_Str",rev.getDocId());
  revProperties.put("String_Node_Str",rev.getRevId());
  revProperties.put("String_Node_Str","String_Node_Str");
  rev.setProperties(revProperties);
  List<String> revHistory=new ArrayList<String>();
  revHistory.add(rev.getRevId());
  revHistory.add("String_Node_Str");
  revHistory.add("String_Node_Str");
  revHistory.add("String_Node_Str");
  CBLStatus status=database.forceInsert(rev,revHistory,null);
  Assert.assertEquals(201,status.getCode());
  Assert.assertEquals(1,database.getDocumentCount());
  verifyHistory(database,rev,revHistory);
  CBLRevision conflict=new CBLRevision("String_Node_Str","String_Node_Str",false,database);
  Map<String,Object> conflictProperties=new HashMap<String,Object>();
  conflictProperties.put("String_Node_Str",conflict.getDocId());
  conflictProperties.put("String_Node_Str",conflict.getRevId());
  conflictProperties.put("String_Node_Str","String_Node_Str");
  conflict.setProperties(conflictProperties);
  List<String> conflictHistory=new ArrayList<String>();
  conflictHistory.add(conflict.getRevId());
  conflictHistory.add("String_Node_Str");
  conflictHistory.add("String_Node_Str");
  conflictHistory.add("String_Node_Str");
  conflictHistory.add("String_Node_Str");
  status=database.forceInsert(conflict,conflictHistory,null);
  Assert.assertEquals(201,status.getCode());
  Assert.assertEquals(1,database.getDocumentCount());
  verifyHistory(database,conflict,conflictHistory);
  CBLRevision other=new CBLRevision("String_Node_Str","String_Node_Str",false,database);
  Map<String,Object> otherProperties=new HashMap<String,Object>();
  otherProperties.put("String_Node_Str","String_Node_Str");
  other.setProperties(otherProperties);
  List<String> otherHistory=new ArrayList<String>();
  otherHistory.add(other.getRevId());
  status=database.forceInsert(other,otherHistory,null);
  Assert.assertEquals(CBLStatus.CREATED,status.getCode());
  CBLRevision rev2=database.getDocumentWithIDAndRev(rev.getDocId(),"String_Node_Str",EnumSet.noneOf(CBLDatabase.TDContentOptions.class));
  Assert.assertEquals(rev.getDocId(),rev2.getDocId());
  Assert.assertEquals("String_Node_Str",rev2.getRevId());
  Assert.assertEquals(8,database.getLastSequence());
  CBLRevision current=database.getDocumentWithIDAndRev(rev.getDocId(),null,EnumSet.noneOf(CBLDatabase.TDContentOptions.class));
  Assert.assertEquals(conflict,current);
  CBLChangesOptions options=new CBLChangesOptions();
  CBLRevisionList changes=database.changesSince(0,options,null);
  CBLRevisionList expectedChanges=new CBLRevisionList();
  expectedChanges.add(conflict);
  expectedChanges.add(other);
  Assert.assertEquals(changes,expectedChanges);
  options.setIncludeConflicts(true);
  changes=database.changesSince(0,options,null);
  expectedChanges=new CBLRevisionList();
  expectedChanges.add(rev);
  expectedChanges.add(conflict);
  expectedChanges.add(other);
  Assert.assertEquals(changes,expectedChanges);
}