use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.
the class DocumentQueryParserTest method shouldFindByName.
@Test
public void shouldFindByName() {
DocumentQuery query = parser.parse("findByName", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
assertEquals(Document.of("name", "name"), query.getCondition().get().getDocument());
}
use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.
the class DocumentQueryParserTest method shouldFindByNameWithPageSortArgument.
@Test
public void shouldFindByNameWithPageSortArgument() {
Pagination pagination = Pagination.of(2L, 10);
Sort sort = Sort.of("age", Sort.SortType.ASC);
DocumentQuery query = parser.parse("findByName", new Object[] { "name", pagination, sort }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
assertEquals(Document.of("name", "name"), query.getCondition().get().getDocument());
assertEquals(pagination.getMaxResults(), query.getMaxResults());
assertEquals(pagination.getFirstResult(), query.getFirstResult());
assertEquals(sort, query.getSorts().get(0));
}
use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.
the class DocumentQueryParserTest method shouldFindByAgeLessThanEqual.
@Test
public void shouldFindByAgeLessThanEqual() {
DocumentQuery query = parser.parse("findByAgeLessThanEqual", new Object[] { 10 }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.LESSER_EQUALS_THAN, query.getCondition().get().getCondition());
assertEquals(Document.of("age", 10), query.getCondition().get().getDocument());
}
use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.
the class DocumentQueryParserTest method shouldFindByAgeLessThan.
@Test
public void shouldFindByAgeLessThan() {
DocumentQuery query = parser.parse("findByAgeLessThan", new Object[] { 10 }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.LESSER_THAN, query.getCondition().get().getCondition());
assertEquals(Document.of("age", 10), query.getCondition().get().getDocument());
}
use of org.jnosql.diana.api.document.DocumentQuery in project jnosql-artemis by eclipse.
the class DocumentQueryParserTest method shouldFindByNameWithPageSortArgumentAndIgnore.
@Test
public void shouldFindByNameWithPageSortArgumentAndIgnore() {
Pagination pagination = Pagination.of(2L, 10);
Sort sort = Sort.of("age", Sort.SortType.ASC);
DocumentQuery query = parser.parse("findByName", new Object[] { "name", pagination, sort, "ignore" }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
assertEquals(Document.of("name", "name"), query.getCondition().get().getDocument());
assertEquals(pagination.getMaxResults(), query.getMaxResults());
assertEquals(pagination.getFirstResult(), query.getFirstResult());
assertEquals(sort, query.getSorts().get(0));
}
Aggregations