use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class BundleSerializerTest method testDecodesEndBeforeQuery.
@Test
public void testDecodesEndBeforeQuery() throws JSONException {
String json = "{\n" + "from: [ { collectionId: 'coll' } ],\n" + "orderBy: [ { field: { fieldPath: 'foo' } } ],\n" + "endAt: { values: [ { stringValue: 'bar' } ], before: true } }";
Query query = TestUtil.query("coll").orderBy(orderBy("foo")).endAt(bound(/* inclusive= */
false, "bar"));
assertDecodesNamedQuery(json, query);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class BundleSerializerTest method testDecodesGreaterThanFilter.
@Test
public void testDecodesGreaterThanFilter() throws JSONException {
String json = "{\n" + "from: [ { collectionId: 'coll' } ],\n" + "where: {\n" + " fieldFilter: {\n" + " op: 'GREATER_THAN', field: { fieldPath: 'f1' }, value: { stringValue: 'foo' }\n" + " }\n" + "} }";
Query query = TestUtil.query("coll").filter(filter("f1", ">", "foo"));
assertDecodesNamedQuery(json, query);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class BundleSerializerTest method testDoesNotDecodeMultipleCollections.
@Test
public void testDoesNotDecodeMultipleCollections() throws JSONException {
String json = "{ from: [ { collectionId: 'c1' }, { collectionId: 'c2' } ] }";
Query query = TestUtil.query("coll");
assertThrows(IllegalArgumentException.class, () -> assertDecodesNamedQuery(json, query));
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class BundleSerializerTest method testDecodesArrayContainsFilter.
@Test
public void testDecodesArrayContainsFilter() throws JSONException {
String json = "{\n" + "from: [ { collectionId: 'coll' } ],\n" + "where: {\n" + " fieldFilter: {\n" + " op: 'ARRAY_CONTAINS',\n" + " field: { fieldPath: 'f1' },\n" + " value: { stringValue: 'foo' }\n" + " }\n" + "} }";
Query query = TestUtil.query("coll").filter(filter("f1", "array-contains", "foo"));
assertDecodesNamedQuery(json, query);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class BundleSerializerTest method testDecodesArrayContainsAnyFilter.
@Test
public void testDecodesArrayContainsAnyFilter() throws JSONException {
String json = "{\n" + "from: [ { collectionId: 'coll' } ],\n" + "where: {\n" + " fieldFilter: {\n" + " op: 'ARRAY_CONTAINS_ANY',\n" + " field: { fieldPath: 'f1' },\n" + " value: { arrayValue: { values: [ { stringValue: 'foo' } ] } }\n" + " }\n" + "} }";
Query query = TestUtil.query("coll").filter(filter("f1", "array-contains-any", Collections.singletonList("foo")));
assertDecodesNamedQuery(json, query);
}
Aggregations