diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/FluxCollectTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/FluxCollectTest.java index b6707fd4652..b76171e8038 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/FluxCollectTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/FluxCollectTest.java @@ -38,8 +38,10 @@ void identification() { " Flux.just().collect(ImmutableList::of, (list, item) -> {}).single();", " // BUG: Diagnostic contains:", " Flux.just().collect(ImmutableList::of, (list, item) -> {}).defaultIfEmpty(ImmutableList.of());", - " // BUG: Diagnostic contains:", - " Flux.just().collect(ImmutableList::of, (list, item) -> {}).switchIfEmpty(Mono.just(ImmutableList.of()));", + " Flux.just()", + " .collect(ImmutableList::of, (list, item) -> {})", + " // BUG: Diagnostic contains:", + " .switchIfEmpty(Mono.just(ImmutableList.of()));", "", " // BUG: Diagnostic contains:", " Flux.just().collectList().single();", @@ -78,10 +80,14 @@ void identification() { "", " // BUG: Diagnostic contains:", " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).single();", - " // BUG: Diagnostic contains:", - " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).defaultIfEmpty(ImmutableMap.of());", - " // BUG: Diagnostic contains:", - " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).switchIfEmpty(Mono.just(ImmutableMap.of()));", + " Flux.just()", + " .collectMap(identity(), identity(), ImmutableMap::of)", + " // BUG: Diagnostic contains:", + " .defaultIfEmpty(ImmutableMap.of());", + " Flux.just()", + " .collectMap(identity(), identity(), ImmutableMap::of)", + " // BUG: Diagnostic contains:", + " .switchIfEmpty(Mono.just(ImmutableMap.of()));", "", " // BUG: Diagnostic contains:", " Flux.just().collectMultimap(identity()).single();", @@ -99,10 +105,14 @@ void identification() { "", " // BUG: Diagnostic contains:", " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).single();", - " // BUG: Diagnostic contains:", - " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).defaultIfEmpty(ImmutableMap.of());", - " // BUG: Diagnostic contains:", - " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).switchIfEmpty(Mono.just(ImmutableMap.of()));", + " Flux.just()", + " .collectMultimap(identity(), identity(), ImmutableMap::of)", + " // BUG: Diagnostic contains:", + " .defaultIfEmpty(ImmutableMap.of());", + " Flux.just()", + " .collectMultimap(identity(), identity(), ImmutableMap::of)", + " // BUG: Diagnostic contains:", + " .switchIfEmpty(Mono.just(ImmutableMap.of()));", " }", "}", "") @@ -130,7 +140,9 @@ void replacement() { "", " Flux.just().collect(ImmutableList::of, (list, item) -> {}).single();", " Flux.just().collect(ImmutableList::of, (list, item) -> {}).defaultIfEmpty(ImmutableList.of());", - " Flux.just().collect(ImmutableList::of, (list, item) -> {}).switchIfEmpty(Mono.just(ImmutableList.of()));", + " Flux.just()", + " .collect(ImmutableList::of, (list, item) -> {})", + " .switchIfEmpty(Mono.just(ImmutableList.of()));", "", " Flux.just().collectList().single();", " Flux.just().collectList().defaultIfEmpty(ImmutableList.of());", @@ -153,8 +165,12 @@ void replacement() { " Flux.just().collectMap(identity(), identity()).switchIfEmpty(Mono.just(ImmutableMap.of()));", "", " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).single();", - " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).defaultIfEmpty(ImmutableMap.of());", - " Flux.just().collectMap(identity(), identity(), ImmutableMap::of).switchIfEmpty(Mono.just(ImmutableMap.of()));", + " Flux.just()", + " .collectMap(identity(), identity(), ImmutableMap::of)", + " .defaultIfEmpty(ImmutableMap.of());", + " Flux.just()", + " .collectMap(identity(), identity(), ImmutableMap::of)", + " .switchIfEmpty(Mono.just(ImmutableMap.of()));", "", " Flux.just().collectMultimap(identity()).single();", " Flux.just().collectMultimap(identity()).defaultIfEmpty(ImmutableMap.of());", @@ -165,8 +181,12 @@ void replacement() { " Flux.just().collectMultimap(identity(), identity()).switchIfEmpty(Mono.just(ImmutableMap.of()));", "", " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).single();", - " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).defaultIfEmpty(ImmutableMap.of());", - " Flux.just().collectMultimap(identity(), identity(), ImmutableMap::of).switchIfEmpty(Mono.just(ImmutableMap.of()));", + " Flux.just()", + " .collectMultimap(identity(), identity(), ImmutableMap::of)", + " .defaultIfEmpty(ImmutableMap.of());", + " Flux.just()", + " .collectMultimap(identity(), identity(), ImmutableMap::of)", + " .switchIfEmpty(Mono.just(ImmutableMap.of()));", " }", "}", "") @@ -178,7 +198,6 @@ void replacement() { "import com.google.common.collect.ImmutableList;", "import com.google.common.collect.ImmutableMap;", "import reactor.core.publisher.Flux;", - "import reactor.core.publisher.Mono;", "", "class A {", " void m() {",