Program: 160308
Project: 160308
Buggy source:
public void testAllDocsQuery() throws CBLiteException {
  List<CBLRevisionInternal> docs=putDocs(database);
  List<CBLQueryRow> expectedRow=new ArrayList<CBLQueryRow>();
  for (  CBLRevisionInternal rev : docs) {
    Map<String,Object> value=new HashMap<String,Object>();
    value.put("String_Node_Str",rev.getRevId());
    CBLQueryRow queryRow=new CBLQueryRow(rev.getDocId(),0,rev.getDocId(),value,null);
    expectedRow.add(queryRow);
  }
  CBLQueryOptions options=new CBLQueryOptions();
  Map<String,Object> query=database.getAllDocs(options);
  List<CBLQueryRow> expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(2));
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedRows.add(expectedRow.get(1));
  expectedRows.add(expectedRow.get(4));
  Map<String,Object> expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,query);
  options=new CBLQueryOptions();
  options.setStartKey("String_Node_Str");
  options.setEndKey("String_Node_Str");
  query=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedRows.add(expectedRow.get(1));
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,query);
  options.setInclusiveEnd(false);
  query=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,query);
  options=new CBLQueryOptions();
  query=database.getAllDocs(options);
  expectedQueryResult=createExpectedQueryResult(new ArrayList<CBLQueryRow>(),0);
  Assert.assertEquals(expectedQueryResult,query);
  options=new CBLQueryOptions();
  List<Object> docIds=new ArrayList<Object>();
  CBLQueryRow expected2=expectedRow.get(2);
  docIds.add(expected2.getDocument().getId());
  options.setKeys(docIds);
  query=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expected2);
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,query);
}

Fixed version (ground truth):
public void testAllDocsQuery() throws CBLiteException {
  List<CBLRevisionInternal> docs=putDocs(database);
  List<CBLQueryRow> expectedRow=new ArrayList<CBLQueryRow>();
  for (  CBLRevisionInternal rev : docs) {
    Map<String,Object> value=new HashMap<String,Object>();
    value.put("String_Node_Str",rev.getRevId());
    CBLQueryRow queryRow=new CBLQueryRow(rev.getDocId(),0,rev.getDocId(),value,null);
    expectedRow.add(queryRow);
  }
  CBLQueryOptions options=new CBLQueryOptions();
  Map<String,Object> allDocs=database.getAllDocs(options);
  List<CBLQueryRow> expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(2));
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedRows.add(expectedRow.get(1));
  expectedRows.add(expectedRow.get(4));
  Map<String,Object> expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,allDocs);
  options=new CBLQueryOptions();
  options.setStartKey("String_Node_Str");
  options.setEndKey("String_Node_Str");
  allDocs=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedRows.add(expectedRow.get(1));
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,allDocs);
  options.setInclusiveEnd(false);
  allDocs=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expectedRow.get(0));
  expectedRows.add(expectedRow.get(3));
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,allDocs);
  options=new CBLQueryOptions();
  allDocs=database.getAllDocs(options);
  expectedQueryResult=createExpectedQueryResult(new ArrayList<CBLQueryRow>(),0);
  Assert.assertEquals(expectedQueryResult,allDocs);
  options=new CBLQueryOptions();
  List<Object> docIds=new ArrayList<Object>();
  CBLQueryRow expected2=expectedRow.get(2);
  docIds.add(expected2.getDocument().getId());
  options.setKeys(docIds);
  allDocs=database.getAllDocs(options);
  expectedRows=new ArrayList<CBLQueryRow>();
  expectedRows.add(expected2);
  expectedQueryResult=createExpectedQueryResult(expectedRows,0);
  Assert.assertEquals(expectedQueryResult,allDocs);
}