use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector6.
// "$or operator used with full text indexing"
@Test
public void basicSelector6() {
QueryBuilder qb = new QueryBuilder(or(eq("director", "George Lucas"), eq("director", "Steven Spielberg")));
Assertions.assertEquals("{\"selector\": {\"$or\": [{\"director\": {\"$eq\": \"George " + "Lucas\"}}, {\"director\": {\"$eq\": \"Steven Spielberg\"}}]}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector11.
// "elemMatch operator used with full text indexing"
@Test
public void basicSelector11() {
QueryBuilder qb = new QueryBuilder(elemMatch("genre", PredicateExpression.eq("Horror")));
Assertions.assertEquals("{\"selector\": {\"genre\": {\"$elemMatch\": {\"$eq\": " + "\"Horror\"}}}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector14.
// "$type operator used with full text indexing"
@Test
public void basicSelector14() {
QueryBuilder qb = new QueryBuilder(type("year", Type.NUMBER));
Assertions.assertEquals("{\"selector\": {\"year\": {\"$type\": \"number\"}}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector16.
// "$nin operator used with full text indexing"
@Test
public void basicSelector16() {
QueryBuilder qb = new QueryBuilder(and(gt("year", 2009), nin("year", 2010, 2015)));
Assertions.assertEquals("{\"selector\": {\"$and\": [{\"year\": {\"$gt\": 2009}}, " + "{\"year\": {\"$nin\": [2010, 2015]}}]}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector1WithSort.
// "Selector basics"
@Test
public void basicSelector1WithSort() {
QueryBuilder qb = new QueryBuilder(eq("director", "Lars von Trier")).sort(Sort.asc("year"), Sort.desc("director"));
Assertions.assertEquals("{\"selector\": {\"director\": {\"$eq\": \"Lars von Trier\"}}, " + "\"sort\": [{\"year\": \"asc\"}, {\"director\": \"desc\"}]}", qb.build());
}
Aggregations