@Test
public void query() throws Exception {

    try (FDBRecordContext context = fdb.openContext()) {
        openTypedRecordStore(context);
        for (int i = 0; i < 100; i++) {
            TestRecords1Proto.MySimpleRecord.Builder recBuilder = TestRecords1Proto.MySimpleRecord.newBuilder();
            recBuilder.setRecNo(i);
            recBuilder.setStrValueIndexed((i & 1) == 1 ? "odd" : "even");
            recBuilder.setNumValueUnique(i + 1000);
            recordStore.saveRecord(recBuilder.build());
        }
        context.commit();
    }
    RecordQuery query = RecordQuery.newBuilder()
            .setRecordType("MySimpleRecord")
            .setFilter(Query.field("str_value_indexed").equalsValue("even"))
            .build();
    try (FDBRecordContext context = fdb.openContext()) {
        openTypedRecordStore(context);
        int i = 0;
        try (RecordCursorIterator<FDBQueriedRecord<TestRecords1Proto.MySimpleRecord>> cursor = recordStore.executeQuery(query).asIterator()) {
            while (cursor.hasNext()) {
                TestRecords1Proto.MySimpleRecord myrec = cursor.next().getRecord();
                assertTrue((myrec.getNumValueUnique() % 2) == 0);
                i++;
            }
        }
        assertEquals(50, i);
    }
}