Mock services in Spring Reactor
问题 Let's take a look over this simple method: public Mono<SuccessResponse> doSomething(){ return service1.doSomething() .then(service2.doSomething2()) .thenReturn(new SuccessResponse("Awesome"))); } So basically I want to test this method for a scenario in which, service1.doSomething() will throw an error: when(service1.doSomething()).thenReturn(Mono.error(new IllegalStateException("Something bad happened"))); when(service2.doSomething()).thenReturn(Mono.just(new SomeResponse()))