updated
This commit is contained in:
parent
1129c833e6
commit
ff2a5249f3
@ -90,12 +90,12 @@ public class MonoUnitTest {
|
|||||||
|
|
||||||
//Empty list, hence Mono publisher in switchIfEmpty executed after condition evaluation
|
//Empty list, hence Mono publisher in switchIfEmpty executed after condition evaluation
|
||||||
Flux<String> emptyListElements = emptyList.flatMapIterable(l -> l)
|
Flux<String> emptyListElements = emptyList.flatMapIterable(l -> l)
|
||||||
.switchIfEmpty(Mono.defer(() -> sampleMsg("EmptyList")))
|
.switchIfEmpty(Mono.defer(() -> sampleMsg("EmptyList")))
|
||||||
.log();
|
.log();
|
||||||
|
|
||||||
StepVerifier.create(emptyListElements)
|
StepVerifier.create(emptyListElements)
|
||||||
.expectNext("EmptyList")
|
.expectNext("EmptyList")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -105,12 +105,12 @@ public class MonoUnitTest {
|
|||||||
|
|
||||||
//Non empty list, hence Mono publisher in switchIfEmpty won't evaluated.
|
//Non empty list, hence Mono publisher in switchIfEmpty won't evaluated.
|
||||||
Flux<String> listElements = nonEmptyist.flatMapIterable(l -> l)
|
Flux<String> listElements = nonEmptyist.flatMapIterable(l -> l)
|
||||||
.switchIfEmpty(Mono.defer(() -> sampleMsg("NonEmptyList")))
|
.switchIfEmpty(Mono.defer(() -> sampleMsg("NonEmptyList")))
|
||||||
.log();
|
.log();
|
||||||
|
|
||||||
StepVerifier.create(listElements)
|
StepVerifier.create(listElements)
|
||||||
.expectNext("one", "two", "three", "four")
|
.expectNext("one", "two", "three", "four")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<List<String>> monoOfEmptyList() {
|
private Mono<List<String>> monoOfEmptyList() {
|
||||||
@ -126,14 +126,14 @@ public class MonoUnitTest {
|
|||||||
log.debug("Intermediate Test Message....");
|
log.debug("Intermediate Test Message....");
|
||||||
|
|
||||||
StepVerifier.create(msg)
|
StepVerifier.create(msg)
|
||||||
.expectNext("Eager Publisher")
|
.expectNext("Eager Publisher")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
||||||
StepVerifier.create(msg)
|
StepVerifier.create(msg)
|
||||||
.expectNext("Eager Publisher")
|
.expectNext("Eager Publisher")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -144,14 +144,14 @@ public class MonoUnitTest {
|
|||||||
log.debug("Intermediate Test Message....");
|
log.debug("Intermediate Test Message....");
|
||||||
|
|
||||||
StepVerifier.create(deferMsg)
|
StepVerifier.create(deferMsg)
|
||||||
.expectNext("Lazy Publisher")
|
.expectNext("Lazy Publisher")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
||||||
StepVerifier.create(deferMsg)
|
StepVerifier.create(deferMsg)
|
||||||
.expectNext("Lazy Publisher")
|
.expectNext("Lazy Publisher")
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user