[BAEL-1449] Combining Publishers: increase delay time (#3795)

This commit is contained in:
felipeazv 2018-03-09 13:46:02 +01:00 committed by Eugen
parent 71ec77b6d5
commit 00b3a5148e
1 changed files with 28 additions and 28 deletions

View File

@ -15,28 +15,28 @@ public class CombiningPublishersTest {
private static Flux<Integer> evenNumbers = Flux.range(min, max).filter(x -> x % 2 == 0); private static Flux<Integer> evenNumbers = Flux.range(min, max).filter(x -> x % 2 == 0);
private static Flux<Integer> oddNumbers = Flux.range(min, max).filter(x -> x % 2 > 0); private static Flux<Integer> oddNumbers = Flux.range(min, max).filter(x -> x % 2 > 0);
@Test @Test
public void givenFluxes_whenMergeIsInvoked_thenMerge() { public void givenFluxes_whenMergeDelayErrorIsInvoked_thenMergeDelayError() {
Flux<Integer> fluxOfIntegers = Flux.merge( Flux<Integer> fluxOfIntegers = Flux.mergeDelayError(1,
evenNumbers, evenNumbers.delayElements(Duration.ofMillis(2000L)),
oddNumbers); oddNumbers.delayElements(Duration.ofMillis(1000L)));
StepVerifier.create(fluxOfIntegers) StepVerifier.create(fluxOfIntegers)
.expectNext(2)
.expectNext(4)
.expectNext(1) .expectNext(1)
.expectNext(2)
.expectNext(3) .expectNext(3)
.expectNext(5) .expectNext(5)
.expectNext(4)
.expectComplete() .expectComplete()
.verify(); .verify();
} }
@Test @Test
public void givenFluxes_whenMergeWithDelayedElementsIsInvoked_thenMergeWithDelayedElements() { public void givenFluxes_whenMergeWithDelayedElementsIsInvoked_thenMergeWithDelayedElements() {
Flux<Integer> fluxOfIntegers = Flux.merge( Flux<Integer> fluxOfIntegers = Flux.merge(
evenNumbers.delayElements(Duration.ofMillis(500L)), evenNumbers.delayElements(Duration.ofMillis(2000L)),
oddNumbers.delayElements(Duration.ofMillis(300L))); oddNumbers.delayElements(Duration.ofMillis(1000L)));
StepVerifier.create(fluxOfIntegers) StepVerifier.create(fluxOfIntegers)
.expectNext(1) .expectNext(1)
@ -51,8 +51,24 @@ public class CombiningPublishersTest {
@Test @Test
public void givenFluxes_whenConcatIsInvoked_thenConcat() { public void givenFluxes_whenConcatIsInvoked_thenConcat() {
Flux<Integer> fluxOfIntegers = Flux.concat( Flux<Integer> fluxOfIntegers = Flux.concat(
evenNumbers.delayElements(Duration.ofMillis(500L)), evenNumbers.delayElements(Duration.ofMillis(2000L)),
oddNumbers.delayElements(Duration.ofMillis(300L))); 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<Integer> fluxOfIntegers = Flux.merge(
evenNumbers,
oddNumbers);
StepVerifier.create(fluxOfIntegers) StepVerifier.create(fluxOfIntegers)
.expectNext(2) .expectNext(2)
@ -121,22 +137,6 @@ public class CombiningPublishersTest {
} }
@Test
public void givenFluxes_whenMergeDelayErrorIsInvoked_thenMergeDelayError() {
Flux<Integer> 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 @Test
public void givenFluxes_whenMergeWithIsInvoked_thenMergeWith() { public void givenFluxes_whenMergeWithIsInvoked_thenMergeWith() {
Flux<Integer> fluxOfIntegers = evenNumbers.mergeWith(oddNumbers); Flux<Integer> fluxOfIntegers = evenNumbers.mergeWith(oddNumbers);
@ -177,4 +177,4 @@ public class CombiningPublishersTest {
.expectComplete() .expectComplete()
.verify(); .verify();
} }
} }