0

I have a method which returns Mono. So I try to user step verifier to do a integrate test.

public Mono<Void> process(InputBody body)  {

  retrun webClient
        .post()
        .uri("/submit")
        .body(Mono.just(body), InputBody .class)
        .retrieve()
        .bodyToMono(Void.class)
        .subscribe()      
}

I want to do a integrate test for this.

my question is, when we use Web Client Test how to return mono void and step verify it?

 webClient
        .post()
        .uri("/submit")
        .body(Mono.just(body), InputBody .class)
        .exchange()
      .........

how to complete things? I tried but failed.

D.Anush
  • 147
  • 6
  • 15
  • first of all dont subscribe. Your service is a producer, and the calling client is the subscriber. Also subscribe does not return a mono, it returns a `Disposable` which is very different https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html#subscribe-- so you can start there by removing the subscribe. Also i see no stepverifier in your code and also update your code with your full test class and function. – Toerktumlare Jul 25 '22 at 18:01
  • @Toerktumlare , That is what I have no idea to code on step verifier if it return Mono. – D.Anush Jul 26 '22 at 07:35

0 Answers0