@Test
public void writeFieldCheckConditionTest() throws Exception {

    final int OPERATORS_NUMBER = 10;
    final String queryParam = "testQueryParam";
    List<String> operatorsNames = new ArrayList<>(OPERATORS_NUMBER);
    List<FieldPath> fieldsPaths = new ArrayList<>(OPERATORS_NUMBER);
    List<String> result = new ArrayList<>(OPERATORS_NUMBER);
    operatorsNames.addAll(
            Arrays.asList(
                    "$eq", "$ne", "$lt",
                    "$gt", "$lte", "$gte",
                    "$date-from", "$date-to",
                    "$hasTag", "$fulltext"));
    for (String name : operatorsNames)
            fieldsPaths.add(PostgresFieldPath.fromString(name.replace("$", "")));
    result.addAll(
            Arrays.asList(
                    "((document#>'{eq}')=to_json(?)::jsonb)", "((document#>'{ne}')!=to_json(?)::jsonb)",
                    "((document#>'{lt}')<to_json(?)::jsonb)", "((document#>'{gt}')>to_json(?)::jsonb)",
                    "((document#>'{lte}')<=to_json(?)::jsonb)", "((document#>'{gte}')>=to_json(?)::jsonb)",
                    "(parse_timestamp_immutable(document#>'{date-from}')>=(?)::timestamp)",
                    "(parse_timestamp_immutable(document#>'{date-to}')<=(?)::timestamp)",
                    "((document#>'{hasTag}')??(?))",
                    "fulltext@@(to_tsquery('russian',?))"));
    for (int i = 0; i < OPERATORS_NUMBER; ++i) {
        StringWriter body = new StringWriter();
        QueryStatement queryStatement = mock(QueryStatement.class);
        when(queryStatement.getBodyWriter()).thenReturn(body);
        resolver
                .resolve(operatorsNames.get(i))
                .write(queryStatement, resolver, fieldsPaths.get(i), queryParam);
        assertEquals(result.get(i), body.toString().trim());
        verify(queryStatement).pushParameterSetter(any());
    }
}