Program: 160273
Project: 160273
Buggy source:
public void testResolveConflict() throws CouchbaseLiteException, Exception {
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put("String_Node_Str","String_Node_Str");
  properties.put("String_Node_Str","String_Node_Str");
  final Document doc=database.getDocument("String_Node_Str");
  UnsavedRevision newRev1=doc.createRevision();
  newRev1.setUserProperties(properties);
  SavedRevision rev1=newRev1.save();
  Map<String,Object> props1=new HashMap<String,Object>();
  props1.put("String_Node_Str","String_Node_Str");
  SavedRevision rev2a=createRevisionWithProps(rev1,props1,false);
  Map<String,Object> props2=new HashMap<String,Object>();
  props2.put("String_Node_Str","String_Node_Str");
  SavedRevision rev2b=createRevisionWithProps(rev1,props2,true);
  final List<SavedRevision> conflicts=doc.getConflictingRevisions();
  if (conflicts.size() > 1) {
    assertTrue(database.runInTransaction(new TransactionalTask(){
      @Override public boolean run(){
        try {
          Map<String,Object> mergedProps=new HashMap<String,Object>(conflicts.get(0).getUserProperties());
          mergedProps.put("String_Node_Str","String_Node_Str");
          SavedRevision current=doc.getCurrentRevision();
          for (          SavedRevision rev : conflicts) {
            UnsavedRevision newRev=rev.createRevision();
            if (rev.getId().equals(current.getId())) {
              newRev.setProperties(mergedProps);
            }
 else {
              newRev.setIsDeletion(true);
            }
            newRev.save(true);
          }
        }
 catch (        CouchbaseLiteException e) {
          return false;
        }
        return true;
      }
    }
));
  }
  assertEquals(1,doc.getConflictingRevisions().size());
  assertEquals("String_Node_Str",doc.getProperties().get("String_Node_Str"));
}

Fixed version (ground truth):
public void testResolveConflict() throws Exception {
  Map<String,Object> properties=new HashMap<String,Object>();
  properties.put("String_Node_Str","String_Node_Str");
  properties.put("String_Node_Str","String_Node_Str");
  final Document doc=database.getDocument("String_Node_Str");
  UnsavedRevision newRev1=doc.createRevision();
  newRev1.setUserProperties(properties);
  SavedRevision rev1=newRev1.save();
  Map<String,Object> props1=new HashMap<String,Object>();
  props1.put("String_Node_Str","String_Node_Str");
  SavedRevision rev2a=createRevisionWithProps(rev1,props1,false);
  Map<String,Object> props2=new HashMap<String,Object>();
  props2.put("String_Node_Str","String_Node_Str");
  SavedRevision rev2b=createRevisionWithProps(rev1,props2,true);
  Map<String,Object> props3=new HashMap<String,Object>();
  props3.put("String_Node_Str","String_Node_Str");
  SavedRevision rev2c=createRevisionWithProps(rev1,props3,true);
  final List<SavedRevision> conflicts=doc.getConflictingRevisions();
  if (conflicts.size() > 1) {
    assertTrue(database.runInTransaction(new TransactionalTask(){
      @Override public boolean run(){
        try {
          Map<String,Object> mergedProps=new HashMap<String,Object>(conflicts.get(0).getUserProperties());
          mergedProps.put("String_Node_Str","String_Node_Str");
          SavedRevision current=doc.getCurrentRevision();
          for (          SavedRevision rev : conflicts) {
            UnsavedRevision newRev=rev.createRevision();
            if (rev.getId().equals(current.getId())) {
              newRev.setProperties(mergedProps);
            }
 else {
              newRev.setIsDeletion(true);
            }
            newRev.save(true);
          }
        }
 catch (        CouchbaseLiteException e) {
          return false;
        }
        return true;
      }
    }
));
  }
  assertEquals(1,doc.getConflictingRevisions().size());
  assertEquals("String_Node_Str",doc.getProperties().get("String_Node_Str"));
}