Program: 160305
Project: 160305
Buggy source:
public void testConflict() throws Exception {
  Map<String,Object> prop=new HashMap<String,Object>();
  prop.put("String_Node_Str","String_Node_Str");
  Database db=startDatabase();
  Document doc=createDocumentWithProperties(db,prop);
  SavedRevision rev1=doc.getCurrentRevision();
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.putAll(doc.getProperties());
  properties.put("String_Node_Str",2);
  SavedRevision rev2a=doc.putProperties(properties);
  properties=new HashMap<String,Object>();
  properties.putAll(rev1.getProperties());
  properties.put("String_Node_Str",3);
  UnsavedRevision newRev=rev1.createRevision();
  newRev.setProperties(properties);
  SavedRevision rev2b=newRev.saveAllowingConflict();
  assertNotNull("String_Node_Str",rev2b);
  List<SavedRevision> confRevs=new ArrayList<SavedRevision>();
  confRevs.add(rev2b);
  confRevs.add(rev2a);
  assertEquals(doc.getConflictingRevisions(),confRevs);
  assertEquals(doc.getLeafRevisions(),confRevs);
  SavedRevision defaultRev, otherRev;
  if (rev2a.getId().compareTo(rev2b.getId()) > 0) {
    defaultRev=rev2a;
    otherRev=rev2b;
  }
 else {
    defaultRev=rev2b;
    otherRev=rev2a;
  }
  assertEquals(doc.getCurrentRevision(),defaultRev);
  Query query=db.createAllDocumentsQuery();
  query.setAllDocsMode(Query.AllDocsMode.SHOW_CONFLICTS);
  QueryEnumerator rows=query.run();
  assertEquals(rows.getCount(),1);
  QueryRow row=rows.getRow(0);
  List<SavedRevision> revs=row.getConflictingRevisions();
  assertEquals(revs.size(),2);
  assertEquals(revs.get(0),defaultRev);
  assertEquals(revs.get(1),otherRev);
}

Fixed version (ground truth):
public void testConflict() throws Exception {
  Map<String,Object> prop=new HashMap<String,Object>();
  prop.put("String_Node_Str","String_Node_Str");
  Database db=startDatabase();
  Document doc=createDocumentWithProperties(db,prop);
  SavedRevision rev1=doc.getCurrentRevision();
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.putAll(doc.getProperties());
  properties.put("String_Node_Str",2);
  SavedRevision rev2a=doc.putProperties(properties);
  properties=new HashMap<String,Object>();
  properties.putAll(rev1.getProperties());
  properties.put("String_Node_Str",3);
  UnsavedRevision newRev=rev1.createRevision();
  newRev.setProperties(properties);
  SavedRevision rev2b=newRev.saveAllowingConflict();
  assertNotNull("String_Node_Str",rev2b);
  List<SavedRevision> confRevs=new ArrayList<SavedRevision>();
  confRevs.add(rev2b);
  confRevs.add(rev2a);
  assertEquals(doc.getConflictingRevisions(),confRevs);
  assertEquals(doc.getLeafRevisions(),confRevs);
  SavedRevision defaultRev, otherRev;
  Log.d(TAG,String.format("String_Node_Str",rev2a.getId(),rev2b.getId()));
  if (rev2a.getId().compareTo(rev2b.getId()) > 0) {
    Log.d(TAG,"String_Node_Str");
    defaultRev=rev2a;
    otherRev=rev2b;
  }
 else {
    Log.d(TAG,"String_Node_Str");
    defaultRev=rev2b;
    otherRev=rev2a;
  }
  Log.d(TAG,"String_Node_Str" + doc.getCurrentRevision().getId());
  assertEquals(doc.getCurrentRevision(),defaultRev);
  Query query=db.createAllDocumentsQuery();
  query.setAllDocsMode(Query.AllDocsMode.SHOW_CONFLICTS);
  QueryEnumerator rows=query.run();
  assertEquals(rows.getCount(),1);
  QueryRow row=rows.getRow(0);
  List<SavedRevision> revs=row.getConflictingRevisions();
  assertEquals(revs.size(),2);
  assertEquals(revs.get(0),defaultRev);
  assertEquals(revs.get(1),otherRev);
}