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