Mono<ServerResponse> listComments(ServerRequest request) {
        CommentQuery commentQuery = new CommentQuery(request);
        return commentPublicQueryService.list(commentQuery.toRef(), commentQuery.toPageRequest())
            .flatMap(result -> {
                if (commentQuery.getWithReplies()) {
                    return commentPublicQueryService.convertToWithReplyVo(result,
                        commentQuery.getReplySize());
                }
                return Mono.just(result);
            })
            .flatMap(list -> ServerResponse.ok().bodyValue(list));
    }
@Test
    void listComments() {
        when(commentPublicQueryService.list(any(), any(PageRequest.class)))
            .thenReturn(Mono.just(new ListResult<>(1, 10, 0, List.of())));

        Ref ref = new Ref();
        ref.setGroup("content.halo.run");
        ref.setVersion("v1alpha1");
        ref.setKind("Post");
        ref.setName("test");
        webTestClient.get()
            .uri(uriBuilder -> uriBuilder.path("/comments")
                .queryParam("group", ref.getGroup())
                .queryParam("version", ref.getVersion())
                .queryParam("kind", ref.getKind())
                .queryParam("name", ref.getName())
                .queryParam("page", 1)
                .queryParam("size", 10)
                .build())
            .exchange()
            .expectStatus()
            .isOk();
        ArgumentCaptor<Ref> refCaptor = ArgumentCaptor.forClass(Ref.class);
        verify(commentPublicQueryService, times(1))
            .list(refCaptor.capture(), any(PageRequest.class));
        Ref value = refCaptor.getValue();
        assertThat(value).isEqualTo(ref);
    }