use of jakarta.nosql.document.Document in project jnosql-diana by eclipse.
the class DocumentTest method shouldReturnGetClass.
@Test
public void shouldReturnGetClass() {
Value value = Value.of("text");
Document document = Document.of("name", value);
assertEquals(value.get(String.class), document.get(String.class));
}
use of jakarta.nosql.document.Document in project jnosql-diana by eclipse.
the class DocumentTest method shouldCreateAnDocumentInstance.
@Test
public void shouldCreateAnDocumentInstance() {
String name = "name";
Document document = Document.of(name, DEFAULT_VALUE);
assertNotNull(document);
assertEquals(name, document.getName());
assertEquals(DEFAULT_VALUE, document.getValue());
}
use of jakarta.nosql.document.Document in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameNot.
@Test
public void shouldSelectWhereNameNot() {
String documentCollection = "documentCollection";
String name = "Ada Lovelace";
DocumentDeleteQuery query = delete().from(documentCollection).where("name").not().eq(name).build();
DocumentCondition condition = query.getCondition().get();
Document column = condition.getDocument();
DocumentCondition negate = column.get(DocumentCondition.class);
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.NOT, condition.getCondition());
assertEquals(Condition.EQUALS, negate.getCondition());
assertEquals("name", negate.getDocument().getName());
assertEquals(name, negate.getDocument().get());
}
use of jakarta.nosql.document.Document in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
String documentCollection = "documentCollection";
Number value = 10;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").gte(value).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.GREATER_EQUALS_THAN, condition.getCondition());
assertEquals("name", document.getName());
assertEquals(value, document.get());
}
use of jakarta.nosql.document.Document in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameGt.
@Test
public void shouldSelectWhereNameGt() {
String documentCollection = "documentCollection";
Number value = 10;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").gt(value).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.GREATER_THAN, condition.getCondition());
assertEquals("name", document.getName());
assertEquals(value, document.get());
}
Aggregations