DefaultCouchDBDocumentCollectionManager implements CouchDBDocumentCollectionManager { @Override public DocumentEntity update(DocumentEntity entity) { Objects.requireNonNull(entity, "entity is required"); return connector.update(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 shouldReturnErrorOnUpdate() { assertThrows(NullPointerException.class, () -> entityManager.update((DocumentEntity) null)); assertThrows(CouchDBHttpClientException.class, () -> { DocumentEntity entity = getEntity(); entity.remove(CouchDBConstant.ID); entityManager.update(entity); }); assertThrows(CouchDBHttpClientException.class, () -> { DocumentEntity entity = getEntity(); entity.add(CouchDBConstant.ID, "not_found"); entityManager.update(entity); }); }