Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie authored and Stephan202 committed Oct 6, 2022
1 parent ffa4c51 commit c3f6d15
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,29 +271,29 @@ Flux<S> after(Flux<T> flux) {
}
}

/** Prefer {@link Flux#onErrorComplete()} over more contrived alternatives */
static final class FluxOnErrorComplete<T> {
/** Prefer {@link Mono#onErrorComplete()} over more contrived alternatives. */
static final class MonoOnErrorComplete<T> {
@BeforeTemplate
Flux<T> before(Flux<T> flux) {
return flux.onErrorResume(e -> Flux.empty());
Mono<T> before(Mono<T> mono) {
return mono.onErrorResume(e -> Mono.empty());
}

@AfterTemplate
Flux<T> after(Flux<T> flux) {
return flux.onErrorComplete();
Mono<T> after(Mono<T> mono) {
return mono.onErrorComplete();
}
}

/** Prefer {@link Mono#onErrorComplete()} over more contrived alternatives */
static final class MonoOnErrorComplete<T> {
/** Prefer {@link Flux#onErrorComplete()} over more contrived alternatives. */
static final class FluxOnErrorComplete<T> {
@BeforeTemplate
Mono<T> before(Mono<T> mono) {
return mono.onErrorResume(e -> Mono.empty());
Flux<T> before(Flux<T> flux) {
return flux.onErrorResume(e -> Flux.empty());
}

@AfterTemplate
Mono<T> after(Mono<T> mono) {
return mono.onErrorComplete();
Flux<T> after(Flux<T> flux) {
return flux.onErrorComplete();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ Flux<Number> testFluxCast() {
return Flux.just(1).map(Number.class::cast);
}

Flux<Object> testFluxOnErrorComplete() {
return Flux.error(new IllegalStateException()).onErrorResume(e -> Flux.empty());
Mono<Integer> testMonoOnErrorComplete() {
return Mono.just(1).onErrorResume(e -> Mono.empty());
}

Mono<Object> testMonoOnErrorComplete() {
return Mono.error(new IllegalStateException()).onErrorResume(e -> Mono.empty());
Flux<Integer> testFluxOnErrorComplete() {
return Flux.just(1).onErrorResume(e -> Flux.empty());
}

ImmutableSet<PublisherProbe<Void>> testPublisherProbeEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ Flux<Number> testFluxCast() {
return Flux.just(1).cast(Number.class);
}

Flux<Object> testFluxOnErrorComplete() {
return Flux.error(new IllegalStateException()).onErrorComplete();
Mono<Integer> testMonoOnErrorComplete() {
return Mono.just(1).onErrorComplete();
}

Mono<Object> testMonoOnErrorComplete() {
return Mono.error(new IllegalStateException()).onErrorComplete();
Flux<Integer> testFluxOnErrorComplete() {
return Flux.just(1).onErrorComplete();
}

ImmutableSet<PublisherProbe<Void>> testPublisherProbeEmpty() {
Expand Down

0 comments on commit c3f6d15

Please sign in to comment.