public PageListResponse<IndexSetFieldType> getIndexSetFieldTypesListPage(
            final String indexSetId,
            final String fieldNameQuery,
            final List<String> filters,
            final int page,
            final int perPage,
            final String sort,
            final Sorting.Direction order) {

        final List<IndexSetFieldType> filteredFields = getFilteredList(indexSetId, fieldNameQuery, filters, sort, order);
        final int total = filteredFields.size();

        final List<IndexSetFieldType> retrievedPage = filteredFields.stream()
                .skip((long) Math.max(0, page - 1) * perPage)
                .limit(perPage)
                .toList();

        return PageListResponse.create("",
                PaginatedList.PaginationInfo.create(
                        total,
                        retrievedPage.size(),
                        page,
                        perPage),
                total,
                sort,
                order.toString().toLowerCase(Locale.ROOT),
                retrievedPage,
                IndexSetFieldType.ATTRIBUTES,
                IndexSetFieldType.ENTITY_DEFAULTS);

    }
@Test
    void testReturnsEmptyPageIfCannotCreateIndexSetFromConfig() {
        IndexSetConfig indexSetConfig = mock(IndexSetConfig.class);
        doReturn(Optional.of(indexSetConfig)).when(indexSetService).get("I_am_strangely_broken!");
        doReturn(new CustomFieldMappings()).when(indexSetConfig).customFieldMappings();
        doReturn(null).when(indexSetFactory).create(indexSetConfig);


        final PageListResponse<IndexSetFieldType> response = toTest.getIndexSetFieldTypesListPage("I_am_strangely_broken!", "", List.of(), 0, 10, "index_set_id", Sorting.Direction.ASC);

        assertEquals(0, response.total());
        assertTrue(response.elements().isEmpty());

        verifyNoInteractions(indexFieldTypesService);
    }