@Test
  public void test_replicateFrom() {
    String sourceDB = "http://somehost:5984/source_db";
    CouchDbInstance mockInstance = mock(CouchDbInstance.class);
    ReplicationStatus status = new ReplicationStatus();
    when(mockInstance.replicate(any(ReplicationCommand.class))).thenReturn(status);

    StdCouchDbConnector db = new StdCouchDbConnector("test_db", mockInstance);
    db.replicateFrom(sourceDB);
    ArgumentCaptor<ReplicationCommand> ac = ArgumentCaptor.forClass(ReplicationCommand.class);
    verify(mockInstance).replicate(ac.capture());
    assertEquals("test_db", ac.getValue().target);
    assertEquals(sourceDB, ac.getValue().source);
  }
  private void addComment(String itemNumber, String comment) {

    CouchDbConnector dbc = _db.createConnector(dbname, true);
    Map<String, String> doc = new HashMap<String, String>();
    doc.put("_id", UUID.randomUUID().toString());
    doc.put("itemNumber", itemNumber);
    doc.put("comment", comment);
    dbc.create(doc);
  }
  private JSONArray getComments(String itemNumber) {
    JSONArray returnArray = new JSONArray();
    CouchDbConnector dbc = _db.createConnector(dbname, true);

    Map<String, String> doc = new HashMap<String, String>();

    ViewQuery query = new ViewQuery().allDocs().includeDocs(true);
    List<Map> result = dbc.queryView(query, Map.class);
    JSONArray jsonresult = new JSONArray();
    for (Map element : result) {
      JSONObject obj = new JSONObject();
      obj.putAll(element);
      if (itemNumber == null || obj.get("itemNumber").equals(itemNumber)) jsonresult.add(obj);
    }

    System.out.println(jsonresult.toString());

    return jsonresult;
  }