From 22d63005c2c58183c32497dcc022fd4e6193fcd8 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Mon, 13 Mar 2023 17:12:05 +0100 Subject: [PATCH 1/2] Remove then from the shortcut list and from the javadoc --- documentation/docs/guides/shortcut-methods.md | 1 - implementation/src/main/java/io/smallrye/mutiny/Uni.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/documentation/docs/guides/shortcut-methods.md b/documentation/docs/guides/shortcut-methods.md index 7c7d7bdd6..a818bdfa1 100644 --- a/documentation/docs/guides/shortcut-methods.md +++ b/documentation/docs/guides/shortcut-methods.md @@ -33,7 +33,6 @@ The following table lists the available shortcuts available by the `Uni` class: | `uni.map(x -> y)` | `uni.onItem().transform(x -> y)` | | `uni.flatMap(x -> uni2)` | `uni.onItem().transformToUni(x -> uni2)` | | `uni.chain(x -> uni2)` | `uni.onItem().transformToUni(x -> uni2)` | -| `uni.then(() -> uni2)` | `uni.onItem().transformToUni(ignored -> uni2)` | | `uni.invoke(x -> System.out.println(x))` | `uni.onItem().invoke(x -> System.out.println(x))` | | `uni.call(x -> uni2)` | `uni.onItem().call(x -> uni2)` | | `uni.eventually(() -> System.out.println("eventually"))` | `uni.onItemOrFailure().invoke((ignoredItem, ignoredException) -> System.out.println("eventually"))` | diff --git a/implementation/src/main/java/io/smallrye/mutiny/Uni.java b/implementation/src/main/java/io/smallrye/mutiny/Uni.java index 1deb84c69..d3c8973ab 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/Uni.java +++ b/implementation/src/main/java/io/smallrye/mutiny/Uni.java @@ -533,7 +533,7 @@ default Uni chain(Supplier> supplier) { * Session session = getSomeSession(); * session.find(Fruit.class, id) * .chain(fruit -> session.remove(fruit) - * .then(() -> session.flush()) + * .chain(ignored -> session.flush()) * .eventually(() -> session.close()); * } * From edab212f69a1874fdbe90ce8342bfca2de357afb Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Mon, 13 Mar 2023 17:12:32 +0100 Subject: [PATCH 2/2] Apply the new formatter. --- .../main/java/io/smallrye/mutiny/Multi.java | 2 +- .../mutiny/groups/GeneratorEmitter.java | 4 +- .../mutiny/groups/MultiOnFailure.java | 2 +- .../mutiny/groups/MultiOnRequest.java | 2 +- .../mutiny/groups/MultiOnTerminate.java | 2 +- .../io/smallrye/mutiny/groups/UniCreate.java | 2 +- .../io/smallrye/mutiny/groups/UniMemoize.java | 2 +- .../smallrye/mutiny/groups/UniOnFailure.java | 2 +- .../mutiny/groups/UniOnSubscribe.java | 2 +- .../mutiny/helpers/StrictMultiSubscriber.java | 2 +- .../mutiny/helpers/queues/Queues.java | 6 +- .../io/smallrye/mutiny/helpers/spies/Spy.java | 4 +- .../operators/multi/MultiConcatMapOp.java | 2 +- .../mutiny/operators/multi/MultiScanOp.java | 2 +- .../operators/multi/MultiSkipFirstOp.java | 2 +- .../mutiny/subscription/SafeSubscriber.java | 2 +- .../mutiny/converters/UniCreateFromTest.java | 4 +- .../helpers/test/AbstractSubscriberTest.java | 4 +- .../helpers/test/AssertSubscriberTest.java | 60 +++++++++---------- .../mutiny/operators/MultiGroupTest.java | 4 +- .../mutiny/operators/MultiOnEventTest.java | 6 +- .../mutiny/operators/MultiSkipTest.java | 8 +-- .../mutiny/operators/UniAwaitTest.java | 12 ++-- .../operators/UniOnItemFailWithTest.java | 4 +- .../smallrye/mutiny/operators/UniZipTest.java | 10 ++-- .../unchecked/UncheckedFunctionTest.java | 2 +- 26 files changed, 79 insertions(+), 75 deletions(-) diff --git a/implementation/src/main/java/io/smallrye/mutiny/Multi.java b/implementation/src/main/java/io/smallrye/mutiny/Multi.java index 13fb9ea2d..113f9faf9 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/Multi.java +++ b/implementation/src/main/java/io/smallrye/mutiny/Multi.java @@ -609,7 +609,7 @@ default Multi> attachContext() { * Cap all downstream subscriber requests to a maximum value. *

* This is a shortcut for: - * + * *

      * multi.capDemandsUsing(outstanding -> Math.min(outstanding, actual))
      * 
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/GeneratorEmitter.java b/implementation/src/main/java/io/smallrye/mutiny/groups/GeneratorEmitter.java index 227eeffb8..8968968e3 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/groups/GeneratorEmitter.java +++ b/implementation/src/main/java/io/smallrye/mutiny/groups/GeneratorEmitter.java @@ -16,14 +16,14 @@ public interface GeneratorEmitter { /** * Emit an item. - * + * * @param item the item */ void emit(T item); /** * Emit a failure and terminate the stream. - * + * * @param failure the failure */ void fail(Throwable failure); diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnFailure.java b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnFailure.java index 620f3ae7f..b459d7b6f 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnFailure.java +++ b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnFailure.java @@ -27,7 +27,7 @@ * retry ({@link #retry()}). Maybe, you just want to look at the failure ({@link #invoke(Consumer)}). *

* You can configure the type of failure on which your handler is called using: - * + * *

  * {@code
  * multi.onFailure(IOException.class).recoverWithItem("boom")
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnRequest.java b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnRequest.java
index f7e479625..2bad55b58 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnRequest.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnRequest.java
@@ -25,7 +25,7 @@ public MultiOnRequest(Multi upstream) {
      * Action when items are being requested.
      * The request is propagated upstream when the action has completed.
      * An error is forwarded downstream if the action throws an exception.
-     * 
+     *
      * @param consumer the action
      * @return the new {@link Multi}
      */
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnTerminate.java b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnTerminate.java
index e0ba3619c..54b4670d8 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnTerminate.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/MultiOnTerminate.java
@@ -55,7 +55,7 @@ public Multi invoke(Runnable action) {
     /**
      * Attaches an action that is executed when the {@link Multi} emits a completion or a failure or when the subscriber
      * cancels the subscription.
-     * 
+     *
      * @param mapper the function to execute where the first argument is a non-{@code null} exception on failure, and
      *        the second argument is a boolean which is {@code true} when the subscriber cancels the subscription.
      *        The function returns a {@link Uni} and must not be {@code null}.
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/UniCreate.java b/implementation/src/main/java/io/smallrye/mutiny/groups/UniCreate.java
index 421382a15..7f3629472 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/UniCreate.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/UniCreate.java
@@ -159,7 +159,7 @@ public  Uni completionStage(Supplier
-     * 
+     *
      * @param future the future, must not be {@code null}
      * @param  the type of item
      * @return the produced {@link Uni}
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/UniMemoize.java b/implementation/src/main/java/io/smallrye/mutiny/groups/UniMemoize.java
index d7d4a763e..06023645b 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/UniMemoize.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/UniMemoize.java
@@ -81,7 +81,7 @@ public boolean getAsBoolean() {
 
     /**
      * Memoize the received item or failure indefinitely.
-     * 
+     *
      * @return a new {@link Uni}
      * @apiNote This is an experimental API
      */
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnFailure.java b/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnFailure.java
index 1bcb65762..245fdd269 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnFailure.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnFailure.java
@@ -25,7 +25,7 @@
  * ({@link #invoke(Consumer)}).
  * 

* You can configure the type of failure on which your handler is called using: - * + * *

  * {@code
  * uni.onFailure(IOException.class).recoverWithItem("boom")
diff --git a/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnSubscribe.java b/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnSubscribe.java
index f9f92e87e..18ea69f13 100644
--- a/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnSubscribe.java
+++ b/implementation/src/main/java/io/smallrye/mutiny/groups/UniOnSubscribe.java
@@ -26,7 +26,7 @@
  * uni.onSubscription().invoke(sub -> System.out.println("subscribed"));
  * // Delay the subscription by 1 second (or until an asynchronous action completes)
  * uni.onSubscription().call(sub -> Uni.createFrom(1).onItem().delayIt().by(Duration.ofSecond(1)));
- *}
+ * }
  * 
* * @param the type of item diff --git a/implementation/src/main/java/io/smallrye/mutiny/helpers/StrictMultiSubscriber.java b/implementation/src/main/java/io/smallrye/mutiny/helpers/StrictMultiSubscriber.java index 547d87008..796180723 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/helpers/StrictMultiSubscriber.java +++ b/implementation/src/main/java/io/smallrye/mutiny/helpers/StrictMultiSubscriber.java @@ -21,7 +21,7 @@ *
  • 3.9: negative requests should emit an onError(IllegalArgumentException)
  • *
  • 2.12: onSubscribe must be called at most once (subscription cancelled and onError called)
  • * - * + * * @param the type of item */ public class StrictMultiSubscriber diff --git a/implementation/src/main/java/io/smallrye/mutiny/helpers/queues/Queues.java b/implementation/src/main/java/io/smallrye/mutiny/helpers/queues/Queues.java index 2964f2ae6..1d5c121ce 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/helpers/queues/Queues.java +++ b/implementation/src/main/java/io/smallrye/mutiny/helpers/queues/Queues.java @@ -72,7 +72,7 @@ public static Supplier> get(int bufferSize) { /** * Returns an unbounded Queue. * The queue is array-backed. Each array has the given size. If the queue is full, new arrays can be allocated. - * + * * @param size the size of the array * @param the type of item * @return the unbound queue supplier @@ -90,7 +90,7 @@ public static Supplier> unbounded(int size) { /** * Creates a new multi-producer single consumer unbounded queue. - * + * * @param the type of item * @return the queue */ @@ -100,7 +100,7 @@ public static Queue createMpscQueue() { /** * Create a queue of a strict fixed size. - * + * * @param size the queue size * @param the elements type * @return a new queue diff --git a/implementation/src/main/java/io/smallrye/mutiny/helpers/spies/Spy.java b/implementation/src/main/java/io/smallrye/mutiny/helpers/spies/Spy.java index e92de1ed2..f6e10d9ae 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/helpers/spies/Spy.java +++ b/implementation/src/main/java/io/smallrye/mutiny/helpers/spies/Spy.java @@ -24,7 +24,7 @@ public interface Spy { /** * Spy {@link Uni#onSubscription()} events. - * + * * @param upstream the upstream * @param the item type * @return a new {@link Uni} @@ -195,7 +195,7 @@ static MultiOnItemSpy onItem(Multi upstream) { /** * Spy {@link Multi#onItem()} events and optionally keep track of the items. - * + * * @param upstream the upstream * @param trackItems {@code true} when items shall be tracked, {@code false} otherwise * @param the items type diff --git a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiConcatMapOp.java b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiConcatMapOp.java index 59b5c94bb..3f62fae2a 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiConcatMapOp.java +++ b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiConcatMapOp.java @@ -271,7 +271,7 @@ static final class ConcatMapInner extends SwitchableSubscriptionSubscriber /** * Downstream passed as {@code null} to {@link SwitchableSubscriptionSubscriber} as accessors are not reachable. * Effective downstream is {@code parent}. - * + * * @param parent parent as downstream */ ConcatMapInner(ConcatMapMainSubscriber parent) { diff --git a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiScanOp.java b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiScanOp.java index d2e279eba..4b959c79a 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiScanOp.java +++ b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiScanOp.java @@ -9,7 +9,7 @@ /** * Scan operator accumulating items of the same type as the upstream. - * + * * @param the type of item */ public final class MultiScanOp extends AbstractMultiOperator { diff --git a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiSkipFirstOp.java b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiSkipFirstOp.java index 800d66b84..3ed4e05bd 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiSkipFirstOp.java +++ b/implementation/src/main/java/io/smallrye/mutiny/operators/multi/MultiSkipFirstOp.java @@ -23,7 +23,7 @@ public MultiSkipFirstOp(Multi upstream, long numberOfItems) { @Override public void subscribe(MultiSubscriber actual) { if (numberOfItems == 0) { - // Pass-through + // Pass-through upstream.subscribe(actual); } else { upstream.subscribe(new SkipFirstProcessor<>(actual, numberOfItems)); diff --git a/implementation/src/main/java/io/smallrye/mutiny/subscription/SafeSubscriber.java b/implementation/src/main/java/io/smallrye/mutiny/subscription/SafeSubscriber.java index 136bcbc01..6c2f0fe2f 100644 --- a/implementation/src/main/java/io/smallrye/mutiny/subscription/SafeSubscriber.java +++ b/implementation/src/main/java/io/smallrye/mutiny/subscription/SafeSubscriber.java @@ -49,7 +49,7 @@ public SafeSubscriber(Subscriber downstream) { /** * For testing purpose only. - * + * * @return whether the subscriber is in a terminal state. */ boolean isDone() { diff --git a/implementation/src/test/java/io/smallrye/mutiny/converters/UniCreateFromTest.java b/implementation/src/test/java/io/smallrye/mutiny/converters/UniCreateFromTest.java index 6ceb3366c..d550a5063 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/converters/UniCreateFromTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/converters/UniCreateFromTest.java @@ -48,7 +48,7 @@ public void testCreationFromSupplier() { throw new IllegalStateException("boom"); }) .await().indefinitely()).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("boom"); + .hasMessageContaining("boom"); AtomicInteger counter = new AtomicInteger(); Uni uni = Uni.createFrom().item(counter::incrementAndGet); @@ -76,7 +76,7 @@ public void testCreationFromFailureSupplier() { throw new IllegalStateException("boom"); }) .await().indefinitely()).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("boom"); + .hasMessageContaining("boom"); AtomicInteger counter = new AtomicInteger(); Uni uni = Uni.createFrom().failure(() -> new IllegalStateException("boom-" + counter.incrementAndGet())); diff --git a/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AbstractSubscriberTest.java b/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AbstractSubscriberTest.java index 3279ab312..ff98abf07 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AbstractSubscriberTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AbstractSubscriberTest.java @@ -148,12 +148,12 @@ public void testAwaitWithTimeout() { assertThatThrownBy(() -> await() .pollDelay(Duration.ofMillis(1)) .atMost(Duration.ofMillis(2)).untilAsserted(() -> subscriber.awaitFailure(DEFAULT_TIMEOUT))) - .isInstanceOf(ConditionTimeoutException.class); + .isInstanceOf(ConditionTimeoutException.class); assertThatThrownBy(() -> await() .pollDelay(Duration.ofMillis(1)) .atMost(Duration.ofMillis(2)).untilAsserted(subscriber::awaitCompletion)) - .isInstanceOf(ConditionTimeoutException.class); + .isInstanceOf(ConditionTimeoutException.class); } @Test diff --git a/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AssertSubscriberTest.java b/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AssertSubscriberTest.java index 762cf8c37..c3abcb825 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AssertSubscriberTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/helpers/test/AssertSubscriberTest.java @@ -376,7 +376,7 @@ public void testAwaitCompletion() { assertThatThrownBy(() -> Multi.createFrom(). failure(new TestException()) .onFailure().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)).awaitCompletion()).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure"); + .hasMessageContaining("failure"); } @Test @@ -439,28 +439,28 @@ public void testAwaitItem() { assertThatThrownBy(() -> Multi.createFrom().empty() .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItem()).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item"); + .hasMessageContaining("completion").hasMessageContaining("item"); // Already failed assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItem()).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item") - .hasMessageContaining(TestException.class.getName()); + .hasMessageContaining("failure").hasMessageContaining("item") + .hasMessageContaining(TestException.class.getName()); // Completion instead of item assertThatThrownBy(() -> Multi.createFrom().empty() .onCompletion().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItem(SMALL.multipliedBy(2))).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item"); + .hasMessageContaining("completion").hasMessageContaining("item"); // Failure instead of item assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .onFailure().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItem(SMALL.multipliedBy(2))).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item"); + .hasMessageContaining("failure").hasMessageContaining("item"); // Item Multi.createFrom().items(1) @@ -480,8 +480,8 @@ public void testAwaitItem() { .onItem().call(() -> mediumDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItem(SMALL)).isInstanceOf(AssertionError.class) - .hasMessageContaining("item") - .hasMessageContaining(SMALL.toMillis() + " ms"); + .hasMessageContaining("item") + .hasMessageContaining(SMALL.toMillis() + " ms"); } @Test @@ -490,50 +490,50 @@ public void testAwaitNextItems() { assertThatThrownBy(() -> Multi.createFrom().empty() .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2)).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item"); + .hasMessageContaining("completion").hasMessageContaining("item"); assertThatThrownBy(() -> Multi.createFrom().empty() .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, 1)).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item"); + .hasMessageContaining("completion").hasMessageContaining("item"); assertThatThrownBy(() -> Multi.createFrom().empty() .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, 1, Duration.ofSeconds(1))).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item"); + .hasMessageContaining("completion").hasMessageContaining("item"); // Already failed assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2)).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item") - .hasMessageContaining(TestException.class.getName()); + .hasMessageContaining("failure").hasMessageContaining("item") + .hasMessageContaining(TestException.class.getName()); assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, 1)).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item") - .hasMessageContaining(TestException.class.getName()); + .hasMessageContaining("failure").hasMessageContaining("item") + .hasMessageContaining(TestException.class.getName()); assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, 1, Duration.ofSeconds(1))).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item") - .hasMessageContaining(TestException.class.getName()); + .hasMessageContaining("failure").hasMessageContaining("item") + .hasMessageContaining(TestException.class.getName()); // Completion instead of item assertThatThrownBy(() -> Multi.createFrom().emitter(e -> e.emit(1).complete()) .onCompletion().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, SMALL.multipliedBy(2))).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item").hasMessageContaining("0"); + .hasMessageContaining("completion").hasMessageContaining("item").hasMessageContaining("0"); // Failure instead of item assertThatThrownBy(() -> Multi.createFrom().emitter(e -> e.emit(1).fail(new TestException())) .onFailure().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitNextItems(2, SMALL.multipliedBy(2))).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item").hasMessageContaining("0"); + .hasMessageContaining("failure").hasMessageContaining("item").hasMessageContaining("0"); // Item Multi.createFrom().items(1, 2, 3) @@ -556,8 +556,8 @@ public void testAwaitNextItems() { .emitOn(Infrastructure.getDefaultExecutor()) .subscribe().withSubscriber(AssertSubscriber.create(3)) .awaitNextItems(3, SMALL)).isInstanceOf(AssertionError.class) - .hasMessageContaining("item") - .hasMessageContaining(SMALL.toMillis() + " ms"); + .hasMessageContaining("item") + .hasMessageContaining(SMALL.toMillis() + " ms"); } @RepeatedTest(10) @@ -566,27 +566,27 @@ public void testAwaitItems() { assertThatThrownBy(() -> Multi.createFrom().empty() .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitItems(2)).isInstanceOf(AssertionError.class) - .hasMessageContaining("terminal").hasMessageContaining("item"); + .hasMessageContaining("terminal").hasMessageContaining("item"); // Already failed assertThatThrownBy(() -> Multi.createFrom().failure(new TestException()) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitItems(2)).isInstanceOf(AssertionError.class) - .hasMessageContaining("terminal").hasMessageContaining("item"); + .hasMessageContaining("terminal").hasMessageContaining("item"); // Completion instead of item assertThatThrownBy(() -> Multi.createFrom().emitter(e -> e.emit(1).complete()) .onCompletion().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitItems(2, SMALL.multipliedBy(100))).isInstanceOf(AssertionError.class) - .hasMessageContaining("completion").hasMessageContaining("item").hasMessageContaining("1"); + .hasMessageContaining("completion").hasMessageContaining("item").hasMessageContaining("1"); // Failure instead of item assertThatThrownBy(() -> Multi.createFrom().emitter(e -> e.emit(1).fail(new TestException())) .onFailure().call(() -> smallDelay) .subscribe().withSubscriber(AssertSubscriber.create(1)) .awaitItems(2, SMALL.multipliedBy(100))).isInstanceOf(AssertionError.class) - .hasMessageContaining("failure").hasMessageContaining("item").hasMessageContaining("1"); + .hasMessageContaining("failure").hasMessageContaining("item").hasMessageContaining("1"); // Item Multi.createFrom().items(1, 2, 3) @@ -609,20 +609,20 @@ public void testAwaitItems() { .runSubscriptionOn(Infrastructure.getDefaultExecutor()) .subscribe().withSubscriber(AssertSubscriber.create(3)) .awaitItems(3, SMALL)).isInstanceOf(AssertionError.class) - .hasMessageContaining("item"); + .hasMessageContaining("item"); // Have received more items than expected. assertThatThrownBy(() -> Multi.createFrom().items(1, 2, 3) .subscribe().withSubscriber(AssertSubscriber.create(3)) .awaitItems(2, SMALL)).isInstanceOf(AssertionError.class) - .hasMessageContaining("item").hasMessageContaining("2").hasMessageContaining("3"); + .hasMessageContaining("item").hasMessageContaining("2").hasMessageContaining("3"); // Already Cancelled assertThatThrownBy(() -> Multi.createFrom().items(1, 2, 3) .subscribe().withSubscriber(new AssertSubscriber<>(1, true)) .awaitItems(2, SMALL)).isInstanceOf(AssertionError.class) - .hasMessageContaining("item").hasMessageContaining("2").hasMessageContaining("0") - .hasMessageContaining("terminal"); + .hasMessageContaining("item").hasMessageContaining("2").hasMessageContaining("0") + .hasMessageContaining("terminal"); // Cancellation while waiting. assertThatThrownBy(() -> { @@ -654,7 +654,7 @@ public void testAssertLast() { assertThatThrownBy( () -> Multi.createFrom().empty().subscribe().withSubscriber(AssertSubscriber.create(1)) .assertLastItem(1)) - .isInstanceOf(AssertionError.class); + .isInstanceOf(AssertionError.class); Multi.createFrom().items(1, 2, 3, 4) .subscribe().withSubscriber(AssertSubscriber.create(2)) diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiGroupTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiGroupTest.java index b1779100b..bea65d773 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiGroupTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiGroupTest.java @@ -182,7 +182,7 @@ public void testCombinationOfToListsAndAwait() { public void testAsListsOnEmptyStream() { assertThat( Multi.createFrom().empty().group().intoLists().of(2).collect().last().await().indefinitely()) - .isNull(); + .isNull(); } @Test @@ -368,7 +368,7 @@ public void testCombinationOfToMultisAndAwait() { public void testAsMultisOnEmptyStream() { assertThat( Multi.createFrom().empty().group().intoMultis().of(2).collect().last().await().indefinitely()) - .isNull(); + .isNull(); } @Test diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiOnEventTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiOnEventTest.java index 9d67d0c66..3dff64b97 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiOnEventTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiOnEventTest.java @@ -600,9 +600,9 @@ public void testCallOnFailure() { return sub.onItem().invoke(c -> twoGotCalled.incrementAndGet()); }) .collect().asList().await().indefinitely()) - .isInstanceOf(CompletionException.class) - .hasCauseInstanceOf(IOException.class) - .hasMessageContaining("boom"); + .isInstanceOf(CompletionException.class) + .hasCauseInstanceOf(IOException.class) + .hasMessageContaining("boom"); assertThat(twoGotCalled).hasValue(2); assertThat(res).hasValue(2); diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiSkipTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiSkipTest.java index e8536c66c..3cd939a51 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/MultiSkipTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/MultiSkipTest.java @@ -294,9 +294,9 @@ public void testMultiSkipUntilPublisherWithUpstreamFailing() { Multi upstream2 = Multi.createFrom().failure(new TestException("boom")); new MultiSkipUntilOtherOp<>(Multi.createBy().concatenating().streams(upstream1, upstream2), Multi.createFrom().item(0)) - .subscribe().withSubscriber(AssertSubscriber.create(10)) - .assertItems(1, 2, 3, 4, 5, 6) - .assertFailedWith(TestException.class, "boom"); + .subscribe().withSubscriber(AssertSubscriber.create(10)) + .assertItems(1, 2, 3, 4, 5, 6) + .assertFailedWith(TestException.class, "boom"); } @Test @@ -309,7 +309,7 @@ public void testMultiSkipUntilPublisherWithDownstreamCancellationAndVerifyOtherI AssertSubscriber subscriber = new MultiSkipUntilOtherOp<>(upstream, Multi.createFrom().nothing().onCancellation().invoke(() -> otherCancelled.set(true))) - .subscribe().withSubscriber(AssertSubscriber.create(1)); + .subscribe().withSubscriber(AssertSubscriber.create(1)); subscriber.cancel(); assertThat(upstreamCancelled).isTrue(); diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/UniAwaitTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/UniAwaitTest.java index f91977d77..5d39e7aec 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/UniAwaitTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/UniAwaitTest.java @@ -52,7 +52,8 @@ public void testAwaitingOnAnAlreadyFailedUni() { public void testAwaitingOnAnAsyncUni() { assertThat( Uni.createFrom().emitter(emitter -> new Thread(() -> emitter.complete(1)).start()).await() - .indefinitely()).isEqualTo(1); + .indefinitely()) + .isEqualTo(1); } @Test @@ -103,7 +104,8 @@ public void testInterruptedTimeout() { public void testAwaitAsOptionalWithResult() { assertThat( Uni.createFrom().emitter(emitter -> new Thread(() -> emitter.complete(1)).start()).await().asOptional() - .indefinitely()).contains(1); + .indefinitely()) + .contains(1); } @Test @@ -121,14 +123,16 @@ public void testAwaitAsOptionalWithFailure() { public void testAwaitAsOptionalWithNull() { assertThat( Uni.createFrom().emitter(emitter -> new Thread(() -> emitter.complete(null)).start()).await() - .asOptional().indefinitely()).isEmpty(); + .asOptional().indefinitely()) + .isEmpty(); } @Test public void testAwaitAsOptionalWithTimeout() { assertThat( Uni.createFrom().emitter(emitter -> new Thread(() -> emitter.complete(1)).start()).await().asOptional() - .atMost(Duration.ofMillis(1000))).contains(1); + .atMost(Duration.ofMillis(1000))) + .contains(1); } @Test diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/UniOnItemFailWithTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/UniOnItemFailWithTest.java index 3cc608074..fdf062aba 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/UniOnItemFailWithTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/UniOnItemFailWithTest.java @@ -94,7 +94,7 @@ public void testFailWithFunction() { assertThatThrownBy(() -> one .onItem().failWith(i -> new IOException("boom-" + i)) .await().indefinitely()).isInstanceOf(CompletionException.class).hasCauseInstanceOf(IOException.class) - .hasMessageContaining("boom-1"); + .hasMessageContaining("boom-1"); } @Test @@ -118,7 +118,7 @@ public void testFailWithSupplier() { assertThatThrownBy(() -> one .onItem().failWith(() -> new IOException("boom")) .await().indefinitely()).isInstanceOf(CompletionException.class).hasCauseInstanceOf(IOException.class) - .hasMessageContaining("boom"); + .hasMessageContaining("boom"); } @Test diff --git a/implementation/src/test/java/io/smallrye/mutiny/operators/UniZipTest.java b/implementation/src/test/java/io/smallrye/mutiny/operators/UniZipTest.java index d7e56b5d1..80dce641a 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/operators/UniZipTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/operators/UniZipTest.java @@ -254,17 +254,17 @@ public void testDiscardingItems() { assertThatThrownBy( () -> Uni.combine().all().unis(uni1, uni2, uni3, failed, uni4).discardItems().await().indefinitely()) - .isInstanceOf(CompletionException.class) - .hasCauseInstanceOf(IOException.class) - .hasMessageContaining("boom"); + .isInstanceOf(CompletionException.class) + .hasCauseInstanceOf(IOException.class) + .hasMessageContaining("boom"); Uni failed2 = Uni.createFrom().failure(new IllegalStateException("d'oh")); assertThatThrownBy( () -> Uni.combine().all().unis(uni1, uni2, uni3, failed, uni4, failed2).collectFailures().discardItems() .await().indefinitely()) - .isInstanceOf(CompositeException.class) - .hasMessageContaining("boom").hasMessageContaining("d'oh"); + .isInstanceOf(CompositeException.class) + .hasMessageContaining("boom").hasMessageContaining("d'oh"); } @Test diff --git a/implementation/src/test/java/io/smallrye/mutiny/unchecked/UncheckedFunctionTest.java b/implementation/src/test/java/io/smallrye/mutiny/unchecked/UncheckedFunctionTest.java index 37db0ed7f..dc5f0efa5 100644 --- a/implementation/src/test/java/io/smallrye/mutiny/unchecked/UncheckedFunctionTest.java +++ b/implementation/src/test/java/io/smallrye/mutiny/unchecked/UncheckedFunctionTest.java @@ -31,7 +31,7 @@ public void testWithMap() { } return i; })).await().indefinitely()).isInstanceOf(RuntimeException.class).hasCauseInstanceOf(IOException.class) - .hasMessageContaining("boom"); + .hasMessageContaining("boom"); assertThatThrownBy(() -> Uni.createFrom().item(0) .map(function(i -> {