Search in sources :

Example 1 with DocumentEntityPrePersist

use of jakarta.nosql.mapping.document.DocumentEntityPrePersist in project jnosql-diana by eclipse.

the class DefaultDocumentEventPersistManagerTest method shouldFirePreDocument.

@Test
public void shouldFirePreDocument() {
    DocumentEntity entity = DocumentEntity.of("collection");
    subject.firePreDocument(entity);
    ArgumentCaptor<DocumentEntityPrePersist> captor = ArgumentCaptor.forClass(DocumentEntityPrePersist.class);
    verify(documentEntityPrePersistEvent).fire(captor.capture());
    DocumentEntityPrePersist captorValue = captor.getValue();
    assertEquals(entity, captorValue.getEntity());
}
Also used : DocumentEntity(jakarta.nosql.document.DocumentEntity) DocumentEntityPrePersist(jakarta.nosql.mapping.document.DocumentEntityPrePersist) Test(org.junit.jupiter.api.Test)

Example 2 with DocumentEntityPrePersist

use of jakarta.nosql.mapping.document.DocumentEntityPrePersist in project jnosql-diana by eclipse.

the class DocumentEntityPrePersistTest method shouldReturnInstance.

@Test
public void shouldReturnInstance() {
    DocumentEntity entity = DocumentEntity.of("collection");
    DocumentEntityPrePersist prePersist = new DefaultDocumentEntityPrePersist(entity);
    assertEquals(entity, prePersist.getEntity());
}
Also used : DocumentEntity(jakarta.nosql.document.DocumentEntity) DocumentEntityPrePersist(jakarta.nosql.mapping.document.DocumentEntityPrePersist) Test(org.junit.jupiter.api.Test)

Aggregations

DocumentEntity (jakarta.nosql.document.DocumentEntity)2 DocumentEntityPrePersist (jakarta.nosql.mapping.document.DocumentEntityPrePersist)2 Test (org.junit.jupiter.api.Test)2