DefaultCouchDBDocumentCollectionManager implements CouchDBDocumentCollectionManager { @Override public DocumentEntity insert(DocumentEntity entity) { Objects.requireNonNull(entity, "entity is required"); return connector.insert(entity); } DefaultCouchDBDocumentCollectionManager(CouchDBHttpClient connector); @Override DocumentEntity insert(DocumentEntity entity); @Override DocumentEntity insert(DocumentEntity entity, Duration ttl); @Override Iterable<DocumentEntity> insert(Iterable<DocumentEntity> entities); @Override Iterable<DocumentEntity> insert(Iterable<DocumentEntity> entities, Duration ttl); @Override DocumentEntity update(DocumentEntity entity); @Override Iterable<DocumentEntity> update(Iterable<DocumentEntity> entities); @Override void delete(DocumentDeleteQuery query); @Override Stream<DocumentEntity> select(DocumentQuery query); @Override long count(); @Override long count(String documentCollection); @Override void close();  }
@Test public void shouldInsert() { DocumentEntity entity = getEntity(); DocumentEntity documentEntity = entityManager.insert(entity); assertEquals(entity, documentEntity); }
@Test public void shouldInsertNotId() { DocumentEntity entity = getEntity(); entity.remove(CouchDBConstant.ID); DocumentEntity documentEntity = entityManager.insert(entity); assertTrue(documentEntity.find(CouchDBConstant.ID).isPresent()); }
@Test public void shouldConvertFromListSubdocumentList() { DocumentEntity entity = createSubdocumentList(); entityManager.insert(entity); }