Search in sources :

Example 56 with DocumentQuery

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

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameLike.

@Test
public void shouldSelectWhereNameLike() {
    DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").like("Ada").build();
    DocumentQuery queryExpected = select().from("Person").where("name").like("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Example 57 with DocumentQuery

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

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameOr.

@Test
public void shouldSelectWhereNameOr() {
    DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id").between(10, 20).or("name").eq("Ada").build();
    DocumentQuery queryExpected = select().from("Person").where("_id").between(10L, 20L).or("name").eq("Ada").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Example 58 with DocumentQuery

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

the class DefaultDocumentMapperSelectBuilderTest method shouldQueryByEmbeddable.

@Test
public void shouldQueryByEmbeddable() {
    DocumentQuery query = mapperBuilder.selectFrom(Worker.class).where("job.city").eq("Salvador").build();
    DocumentQuery queryExpected = select().from("Worker").where("city").eq("Salvador").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) Worker(jakarta.nosql.tck.entities.Worker) Test(org.junit.jupiter.api.Test)

Example 59 with DocumentQuery

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

the class DefaultDocumentMapperSelectBuilderTest method shouldQueryBySubEntity.

@Test
public void shouldQueryBySubEntity() {
    DocumentQuery query = mapperBuilder.selectFrom(Address.class).where("zipCode.zip").eq("01312321").build();
    DocumentQuery queryExpected = select().from("Address").where("zipCode.zip").eq("01312321").build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) Address(jakarta.nosql.tck.entities.Address) Test(org.junit.jupiter.api.Test)

Example 60 with DocumentQuery

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

the class DefaultDocumentMapperSelectBuilderTest method shouldSelectWhereNameGte.

@Test
public void shouldSelectWhereNameGte() {
    DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id").gte(10).build();
    DocumentQuery queryExpected = select().from("Person").where("_id").gte(10L).build();
    assertEquals(queryExpected, query);
}
Also used : DocumentQuery(jakarta.nosql.document.DocumentQuery) Person(jakarta.nosql.tck.entities.Person) Test(org.junit.jupiter.api.Test)

Aggregations

DocumentQuery (jakarta.nosql.document.DocumentQuery)292 Test (org.junit.jupiter.api.Test)234 DocumentEntity (jakarta.nosql.document.DocumentEntity)123 Document (jakarta.nosql.document.Document)98 DocumentCondition (jakarta.nosql.document.DocumentCondition)64 DocumentDeleteQuery (jakarta.nosql.document.DocumentDeleteQuery)55 Person (jakarta.nosql.tck.entities.Person)50 List (java.util.List)50 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)44 Arrays.asList (java.util.Arrays.asList)34 ValueSource (org.junit.jupiter.params.provider.ValueSource)30 Pagination (jakarta.nosql.mapping.Pagination)27 ArrayList (java.util.ArrayList)26 Collectors (java.util.stream.Collectors)19 DocumentQuery.select (jakarta.nosql.document.DocumentQuery.select)18 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)16 Matchers.contains (org.hamcrest.Matchers.contains)16 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)16 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)16 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)16