Spring rest docs using webTestClient with StepVerifier (Reactive endpoints)

881 Views Asked by At

I am trying to create unit tests for my controllers using webTestClient. I need to generate api documentation using Spring rest docs. I used to create my assets using StepVerifier (Endpoints returning Mono of Flux)

Is there anyway of using StepVerifier and create automatic documentation using Spring rest docs.

This code works fine:

 val result = webTestClient.get()
                .uri("/api/clients")
                .exchange()
                .expectStatus().isOk
                .expectBody().consumeWith(document("client-getAll"))

Which would be the way to define test using stepverifier?

   val result = webTestClient.get()
                .uri("/api/clients")
                .exchange()
                .expectStatus().isOk
                .returnResult<Client>().responseBody

        StepVerifier.create(result)
                .expectNextCount(1)
                .verifyComplete()
0

There are 0 best solutions below