Skip to content

Commit

Permalink
Group FluxJust rules together
Browse files Browse the repository at this point in the history
  • Loading branch information
tijana-ninkovic committed Jul 18, 2024
1 parent 5ebaf87 commit a067fe7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,20 @@ Flux<T> after() {
}

/** Prefer {@link Flux#just(Object)} over more contrived alternatives. */
static final class FluxJust {
static final class FluxJust<T> {
@BeforeTemplate
Flux<Integer> before(int start) {
return Flux.range(start, 1);
Flux<Integer> before(int value) {
return Flux.range(value, 1);
}

@BeforeTemplate
Flux<T> before(T value) {
return Mono.just(value).repeat().take(1);
}

@AfterTemplate
Flux<Integer> after(int start) {
return Flux.just(start);
Flux<T> after(T value) {
return Flux.just(value);
}
}

Expand Down Expand Up @@ -1727,19 +1732,6 @@ PublisherProbe<T> after() {
}
}

/** Prefer {@link Flux#just(Object)} over more verbose alternatives. */
static final class MonoJustRepeatTakeOne<T> {
@BeforeTemplate
Flux<T> before(T value) {
return Mono.just(value).repeat().take(1);
}

@AfterTemplate
Flux<T> after(T value) {
return Flux.just(value);
}
}

/** Prefer {@link Mono#as(Function)} when creating a {@link StepVerifier}. */
static final class StepVerifierFromMono<T> {
@BeforeTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ ImmutableSet<Flux<?>> testFluxEmpty() {
Flux.range(0, 0));
}

Flux<Integer> testFluxJust() {
return Flux.range(0, 1);
ImmutableSet<Flux<?>> testFluxJust() {
return ImmutableSet.of(Flux.range(0, 1), Mono.just(1).repeat().take(1));
}

ImmutableSet<Mono<?>> testMonoIdentity() {
Expand Down Expand Up @@ -584,10 +584,6 @@ ImmutableSet<PublisherProbe<Void>> testPublisherProbeEmpty() {
return ImmutableSet.of(PublisherProbe.of(Mono.empty()), PublisherProbe.of(Flux.empty()));
}

Flux<Integer> testMonoJustRepeatTakeOne() {
return Mono.just(5).repeat().take(1);
}

ImmutableSet<StepVerifier.FirstStep<Integer>> testStepVerifierFromMono() {
return ImmutableSet.of(
StepVerifier.create(Mono.just(1)), Mono.just(2).flux().as(StepVerifier::create));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ ImmutableSet<Flux<?>> testFluxEmpty() {
Flux.empty());
}

Flux<Integer> testFluxJust() {
return Flux.just(0);
ImmutableSet<Flux<?>> testFluxJust() {
return ImmutableSet.of(Flux.just(0), Flux.just(1));
}

ImmutableSet<Mono<?>> testMonoIdentity() {
Expand Down Expand Up @@ -573,10 +573,6 @@ ImmutableSet<PublisherProbe<Void>> testPublisherProbeEmpty() {
return ImmutableSet.of(PublisherProbe.empty(), PublisherProbe.empty());
}

Flux<Integer> testMonoJustRepeatTakeOne() {
return Flux.just(5);
}

ImmutableSet<StepVerifier.FirstStep<Integer>> testStepVerifierFromMono() {
return ImmutableSet.of(
Mono.just(1).as(StepVerifier::create), Mono.just(2).as(StepVerifier::create));
Expand Down

0 comments on commit a067fe7

Please sign in to comment.