public PaginatedList<AuthzRoleDTO> findPaginatedByIdsWithFilter(SearchQuery searchQuery,
                                                                    Predicate<AuthzRoleDTO> filter,
                                                                    int page,
                                                                    int perPage,
                                                                    String sortField,
                                                                    String order,
                                                                    Set<String> roleIds) {
        final DBQuery.Query dbQuery = buildRoleIdsQuery(searchQuery, roleIds);
        final DBSort.SortBuilder sortBuilder = getSortBuilder(order, sortField);

        return findPaginatedWithQueryFilterAndSort(dbQuery, filter, sortBuilder, page, perPage);
    }
@Test
    void findPaginatedByIdsWithFilter(@Mock SearchQuery searchQuery) {
        final String testRoleId = "56701ac4c8302ff6bee2a65d";
        final String readerRoleId = "564c6707c8306e079f718980";
        final String archiveManagerRoleId = "58dbaa158ae4923256dc6265";
        final Set<String> roleIds = ImmutableSet.of(testRoleId, readerRoleId, archiveManagerRoleId);

        when(searchQuery.toDBQuery()).thenReturn(DBQuery.empty());

        final PaginatedList<AuthzRoleDTO> result = service.findPaginatedByIdsWithFilter(
                searchQuery,
                (role) -> testRoleId.equals(role.id()),
                1,
                10,
                "id",
                "asc",
                roleIds
        );

        assertThat(result.delegate().size()).isEqualTo(1);
        assertThat(result.delegate().get(0)).satisfies(role -> {
            assertThat(role.id()).isEqualTo(testRoleId);
            assertThat(role.name()).isEqualTo("Test Role");
        });
        assertThat(result.grandTotal()).get().isEqualTo(16L);
        assertThat(result.pagination()).satisfies(paginationInfo -> {
            assertThat(paginationInfo.count()).isEqualTo(1);
            assertThat(paginationInfo.total()).isEqualTo(1);
            assertThat(paginationInfo.page()).isEqualTo(1);
            assertThat(paginationInfo.perPage()).isEqualTo(10);
        });
    }