List<MappingField> resolveAndValidateFields(List<MappingField> userFields, Map<String, ?> options) {
        if (options.get(OPTION_FORMAT) == null) {
            throw QueryException.error("Missing '" + OPTION_FORMAT + "' option");
        }
        if (options.get(OPTION_PATH) == null) {
            throw QueryException.error("Missing '" + OPTION_PATH + "' option");
        }

        List<MappingField> fields = findMetadataResolver(options).resolveAndValidateFields(userFields, options);
        if (fields.isEmpty()) {
            throw QueryException.error("The resolved field list is empty");
        }
        return fields;
    }
@Test
    public void test_resolveAndValidateFields() {
        // given
        Map<String, String> options = Map.of(OPTION_FORMAT, FORMAT, OPTION_PATH, "/path", OPTION_GLOB, "*");

        given(resolver.resolveAndValidateFields(emptyList(), options))
                .willReturn(singletonList(new MappingField("field", QueryDataType.VARCHAR)));

        // when
        List<MappingField> resolvedFields = resolvers.resolveAndValidateFields(emptyList(), options);

        // then
        assertThat(resolvedFields).containsOnly(new MappingField("field", QueryDataType.VARCHAR));
    }