RavenDBDocumentCollectionManager implements DocumentCollectionManager { @Override public DocumentEntity insert(DocumentEntity entity) { Objects.requireNonNull(entity, "entity is required"); try (IDocumentSession session = store.openSession()) { insert(entity, null, session); } return entity; } RavenDBDocumentCollectionManager(DocumentStore store); @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(String documentCollection); @Override void close();  }
@Test public void shouldInsert() { DocumentEntity entity = getEntity(); DocumentEntity documentEntity = entityManager.insert(entity); assertTrue(documentEntity.getDocuments().stream().map(Document::getName).anyMatch(s -> s.equals("_id"))); }
@Test public void shouldConvertFromListSubdocumentList() { DocumentEntity entity = createSubdocumentList(); entityManager.insert(entity); }