Created
December 24, 2019 10:31
-
-
Save ayushi24041992/9215479636141d9a196d7cc6ba424fcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void fluxErrorHandling_onErrorMap(){ | |
Flux<String> stringFlux = Flux.just("a","b","c") | |
.concatWith(Flux.error(new RuntimeException("Exception Occurred"))) | |
.concatWith(Flux.just("D")) | |
.onErrorMap((e) -> new CustomException(e)); // here returning a simple string on any errors | |
StepVerifier.create(stringFlux.log()) | |
.expectSubscription() | |
.expectNext("a","b","c") | |
.expectError(CustomException.class) | |
.verify(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment