public PageListResponse<IndexSetFieldTypeSummary> getIndexSetFieldTypeSummary(final Set<String> streamIds,
                                                                                  final String fieldName,
                                                                                  final Predicate<String> indexSetPermissionPredicate) {
        return getIndexSetFieldTypeSummary(streamIds, fieldName, indexSetPermissionPredicate, 1, 50, DEFAULT_SORT.id(), DEFAULT_SORT.direction());
    }
@Test
    void testComplexPaginationScenario() {
        Predicate<String> indexSetPermissionPredicate = indexSetID -> indexSetID.contains("canSee");
        final Set<String> allStreams = Set.of("stream_id_1", "stream_id_2", "stream_id_3", "stream_id_4", "stream_id_5");
        doReturn(Set.of("canSee1", "cannotSee", "canSeeButDoesNotExist", "canSee2", "canSee3"))
                .when(streamService)
                .indexSetIdsByIds(allStreams);

        doReturn(List.of("Stream1", "Stream2")).when(streamService).streamTitlesForIndexSet("canSee1");
        doReturn(List.of("Stream2")).when(streamService).streamTitlesForIndexSet("canSee2");
        doReturn(List.of("Stream3")).when(streamService).streamTitlesForIndexSet("canSee3");

        doReturn(List.of("text", "keyword")).when(indexFieldTypesService).fieldTypeHistory("canSee1", "field_name", true);
        doReturn(List.of("text")).when(indexFieldTypesService).fieldTypeHistory("canSee2", "field_name", true);
        doReturn(List.of()).when(indexFieldTypesService).fieldTypeHistory("canSee3", "field_name", true);

        mockIndexSetConfig("canSee1", "Aa");
        mockIndexSetConfig("canSee2", "Ab");
        mockIndexSetConfig("canSee3", "Z");
        doReturn(Optional.empty()).when(indexSetService).get("canSeeButDoesNotExist");

        final PageListResponse<IndexSetFieldTypeSummary> allResultsOnSinglePageSortedByIdAsc = toTest.getIndexSetFieldTypeSummary(allStreams, "field_name", indexSetPermissionPredicate,
                1, 5, DEFAULT_SORT_FIELD, Sorting.Direction.ASC);
        assertThat(allResultsOnSinglePageSortedByIdAsc.elements())
                .isNotNull()
                .isEqualTo(List.of(
                        new IndexSetFieldTypeSummary("canSee1", "Aa", List.of("Stream1", "Stream2"), List.of("text", "keyword")),
                        new IndexSetFieldTypeSummary("canSee2", "Ab", List.of("Stream2"), List.of("text")),
                        new IndexSetFieldTypeSummary("canSee3", "Z", List.of("Stream3"), List.of())
                ));
        assertThat(allResultsOnSinglePageSortedByIdAsc.total()).isEqualTo(3);
        assertThat(allResultsOnSinglePageSortedByIdAsc.paginationInfo().count()).isEqualTo(3);

        final PageListResponse<IndexSetFieldTypeSummary> thirdSingleElemPageWithSortByIdDesc = toTest.getIndexSetFieldTypeSummary(allStreams, "field_name", indexSetPermissionPredicate,
                3, 1, DEFAULT_SORT_FIELD, Sorting.Direction.DESC);
        assertThat(thirdSingleElemPageWithSortByIdDesc.elements())
                .isNotNull()
                .isEqualTo(List.of(
                        new IndexSetFieldTypeSummary("canSee1", "Aa", List.of("Stream1", "Stream2"), List.of("text", "keyword"))
                ));
        assertThat(thirdSingleElemPageWithSortByIdDesc.total()).isEqualTo(3);
        assertThat(thirdSingleElemPageWithSortByIdDesc.paginationInfo().count()).isEqualTo(1);

        final PageListResponse<IndexSetFieldTypeSummary> firstTwoElemPageWithSortByTitleDesc = toTest.getIndexSetFieldTypeSummary(allStreams, "field_name", indexSetPermissionPredicate,
                1, 2, INDEX_SET_TITLE, Sorting.Direction.DESC);
        assertThat(firstTwoElemPageWithSortByTitleDesc.elements())
                .isNotNull()
                .isEqualTo(List.of(
                        new IndexSetFieldTypeSummary("canSee3", "Z", List.of("Stream3"), List.of()),
                        new IndexSetFieldTypeSummary("canSee2", "Ab", List.of("Stream2"), List.of("text"))
                ));
        assertThat(firstTwoElemPageWithSortByTitleDesc.total()).isEqualTo(3);
        assertThat(firstTwoElemPageWithSortByTitleDesc.paginationInfo().count()).isEqualTo(2);

    }