use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method complexSelector2.
@Test
public void complexSelector2() {
QueryBuilder qb = new QueryBuilder(or(and(eq("Actor", "Schwarzenegger"), eq("Year", 2012)), and(eq("Actor", "de Vito"), eq("Year", 2001))));
Assertions.assertEquals("{\"selector\": {\"$or\": [{\"$and\": [{\"Actor\": {\"$eq\": " + "\"Schwarzenegger\"}}, {\"Year\": {\"$eq\": 2012}}]}, {\"$and\": [{\"Actor\": " + "{\"$eq\": \"de Vito\"}}, {\"Year\": {\"$eq\": 2001}}]}]}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector8.
// "$not operator used with database indexed on the field "year""
@Test
public void basicSelector8() {
QueryBuilder qb = new QueryBuilder(and(gte("year", 1900), lte("year", 1903), not(eq("year", 1901))));
Assertions.assertEquals("{\"selector\": {\"$and\": [{\"year\": {\"$gte\": 1900}}, " + "{\"year\": {\"$lte\": 1903}}, {\"$not\": {\"year\": {\"$eq\": 1901}}}]}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector7.
// "$or operator used with database indexed on the field "year"
@Test
public void basicSelector7() {
QueryBuilder qb = new QueryBuilder(and(eq("year", 1977), or(eq("director", "George Lucas"), eq("director", "Steven Spielberg"))));
Assertions.assertEquals("{\"selector\": {\"$and\": [{\"year\": {\"$eq\": 1977}}, " + "{\"$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 basicSelector1.
// "Selector basics"
@Test
public void basicSelector1() {
QueryBuilder qb = new QueryBuilder(eq("director", "Lars von Trier"));
Assertions.assertEquals("{\"selector\": {\"director\": {\"$eq\": \"Lars von Trier\"}}}", qb.build());
}
use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.
the class QueryTests method basicSelector3.
// "SUBFIELDS"
@Test
public void basicSelector3() {
QueryBuilder qb = new QueryBuilder(eq("imdb.rating", 8));
Assertions.assertEquals("{\"selector\": {\"imdb.rating\": {\"$eq\": 8}}}", qb.build());
}
Aggregations