diff --git a/reactor-core/src/test/java/com/baeldung/reactor/core/CombiningPublishersTest.java b/reactor-core/src/test/java/com/baeldung/reactor/core/CombiningPublishersTest.java index 81dfda3bb3..41769b1b35 100644 --- a/reactor-core/src/test/java/com/baeldung/reactor/core/CombiningPublishersTest.java +++ b/reactor-core/src/test/java/com/baeldung/reactor/core/CombiningPublishersTest.java @@ -15,28 +15,28 @@ public class CombiningPublishersTest { private static Flux evenNumbers = Flux.range(min, max).filter(x -> x % 2 == 0); private static Flux oddNumbers = Flux.range(min, max).filter(x -> x % 2 > 0); - @Test - public void givenFluxes_whenMergeIsInvoked_thenMerge() { - Flux fluxOfIntegers = Flux.merge( - evenNumbers, - oddNumbers); + public void givenFluxes_whenMergeDelayErrorIsInvoked_thenMergeDelayError() { + Flux fluxOfIntegers = Flux.mergeDelayError(1, + evenNumbers.delayElements(Duration.ofMillis(2000L)), + oddNumbers.delayElements(Duration.ofMillis(1000L))); StepVerifier.create(fluxOfIntegers) - .expectNext(2) - .expectNext(4) .expectNext(1) + .expectNext(2) .expectNext(3) .expectNext(5) + .expectNext(4) .expectComplete() .verify(); } + @Test public void givenFluxes_whenMergeWithDelayedElementsIsInvoked_thenMergeWithDelayedElements() { Flux fluxOfIntegers = Flux.merge( - evenNumbers.delayElements(Duration.ofMillis(500L)), - oddNumbers.delayElements(Duration.ofMillis(300L))); + evenNumbers.delayElements(Duration.ofMillis(2000L)), + oddNumbers.delayElements(Duration.ofMillis(1000L))); StepVerifier.create(fluxOfIntegers) .expectNext(1) @@ -51,8 +51,24 @@ public class CombiningPublishersTest { @Test public void givenFluxes_whenConcatIsInvoked_thenConcat() { Flux fluxOfIntegers = Flux.concat( - evenNumbers.delayElements(Duration.ofMillis(500L)), - oddNumbers.delayElements(Duration.ofMillis(300L))); + evenNumbers.delayElements(Duration.ofMillis(2000L)), + oddNumbers.delayElements(Duration.ofMillis(1000L))); + + StepVerifier.create(fluxOfIntegers) + .expectNext(2) + .expectNext(4) + .expectNext(1) + .expectNext(3) + .expectNext(5) + .expectComplete() + .verify(); + } + + @Test + public void givenFluxes_whenMergeIsInvoked_thenMerge() { + Flux fluxOfIntegers = Flux.merge( + evenNumbers, + oddNumbers); StepVerifier.create(fluxOfIntegers) .expectNext(2) @@ -121,22 +137,6 @@ public class CombiningPublishersTest { } - @Test - public void givenFluxes_whenMergeDelayErrorIsInvoked_thenMergeDelayError() { - Flux fluxOfIntegers = Flux.mergeDelayError(1, - evenNumbers.delayElements(Duration.ofMillis(500L)), - oddNumbers.delayElements(Duration.ofMillis(300L))); - - StepVerifier.create(fluxOfIntegers) - .expectNext(1) - .expectNext(2) - .expectNext(3) - .expectNext(5) - .expectNext(4) - .expectComplete() - .verify(); - } - @Test public void givenFluxes_whenMergeWithIsInvoked_thenMergeWith() { Flux fluxOfIntegers = evenNumbers.mergeWith(oddNumbers); @@ -177,4 +177,4 @@ public class CombiningPublishersTest { .expectComplete() .verify(); } -} +} \ No newline at end of file