diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java index 382f1b1cde..c7715d6e3f 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java @@ -559,7 +559,8 @@ Flux after(Flux flux) { static final class MonoFlux { @BeforeTemplate Flux before(Mono mono) { - return Flux.concat(mono); + return Refaster.anyOf( + mono.flatMapMany(Mono::just), mono.flatMapMany(Flux::just), Flux.concat(mono)); } @AfterTemplate diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestInput.java index b56708a238..f8218770f7 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestInput.java @@ -178,8 +178,11 @@ ImmutableSet> testFluxMapNotNull() { Flux.just(1).switchMap(n -> Mono.fromSupplier(() -> n * 2))); } - Flux testMonoFlux() { - return Flux.concat(Mono.just("foo")); + ImmutableSet> testMonoFlux() { + return ImmutableSet.of( + Mono.just("foo").flatMapMany(Mono::just), + Mono.just("bar").flatMapMany(Flux::just), + Flux.concat(Mono.just("baz"))); } ImmutableSet>> testMonoCollectToOptional() { diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestOutput.java index 03a6788e54..7b91b7701f 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/ReactorRulesTestOutput.java @@ -180,8 +180,9 @@ ImmutableSet> testFluxMapNotNull() { Flux.just(1).mapNotNull(n -> n * 2)); } - Flux testMonoFlux() { - return Mono.just("foo").flux(); + ImmutableSet> testMonoFlux() { + return ImmutableSet.of( + Mono.just("foo").flux(), Mono.just("bar").flux(), Mono.just("baz").flux()); } ImmutableSet>> testMonoCollectToOptional() {