use of com.google.firebase.firestore.core.ArrayContainsAnyFilter in project firebase-android-sdk by firebase.
the class RemoteSerializerTest method testArrayContainsAnySerialization.
@Test
public void testArrayContainsAnySerialization() {
FieldFilter inputFilter = filter("field", "array-contains-any", asList(42));
StructuredQuery.Filter apiFilter = serializer.encodeUnaryOrFieldFilter(inputFilter);
ArrayValue.Builder arrayContainsAnyFilterValue = ArrayValue.newBuilder().addValues(Value.newBuilder().setIntegerValue(42));
StructuredQuery.Filter expectedFilter = Filter.newBuilder().setFieldFilter(StructuredQuery.FieldFilter.newBuilder().setField(FieldReference.newBuilder().setFieldPath("field")).setOp(Operator.ARRAY_CONTAINS_ANY).setValue(Value.newBuilder().setArrayValue(arrayContainsAnyFilterValue)).build()).build();
assertEquals(expectedFilter, apiFilter);
FieldFilter roundTripped = serializer.decodeFieldFilter(apiFilter.getFieldFilter());
assertEquals(roundTripped, inputFilter);
assertTrue(roundTripped instanceof ArrayContainsAnyFilter);
}
Aggregations