Difference between flatMap and flatMapMany in WebFlux

Difference between flatMap and flatMapMany in WebFlux

//1. get the cart
Mono<Cart> cartMono = cartRepository.findById(id)

Mono<List<ItemInventoryDTO>> listMono = cartMono
                .flatMap(cart -> getInventoryItems(cart).collectList());

Flux<ItemInventoryDTO> itemInventoryDTOFlux = cartMono.flatMapMany(cart -> getInventoryItems(cart));

So:

flatMap returns a Mono<List> of ItemInventoryDTO items

flatMapMany returns a Flux of ItemInventoryDTO

JUnit5 run a unit test conditionally

I want a JUnit test to run only if I know I am running on my local dev machine and everything is prepared, E.g:

  • DB is set-up with the right data,
  • I have started other services that are called, Payment Service , etc..
  • annotate your test with `@EnableIfEnvironment`
  • Set an Environment Variable

The simplest solution I have found is to use the `HOME` env variable

@EnabledIfEnvironmentVariable(named = "HOME", matches = "/home/razvan.gaston")
public class CartCheckoutShould extends BaseIntegrationTest 

Resournces:

https://nipafx.dev/junit-5-disabled-conditions
https://www.baeldung.com/junit-5-conditional-test-execution