Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public final class NeverMulti extends AbstractMulti<Object> {
* @param <T> the value type
* @return the {@code multi}
*/
@SuppressWarnings("unchecked")
public static <T> Multi<T> never() {
return (Multi<T>) NEVER;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public UniCreateFromPublisher(Flow.Publisher<? extends T> publisher) {
}

@Override
@SuppressWarnings("unchecked")
public void subscribe(UniSubscriber<? super T> subscriber) {
new PublisherSubscriber(publisher, subscriber).forward();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public void testCreationWithArrays() {
CompositeException ce2 = new CompositeException(IO, IAE, OUPS);
assertThat(ce1).hasMessageContaining("iae").hasMessageContaining("io").hasMessageContaining("oups");

assertThat(ce1).getCause().isEqualTo(IAE);
assertThat(ce2).getCause().isEqualTo(IO);
assertThat(ce1).cause().isEqualTo(IAE);
assertThat(ce2).cause().isEqualTo(IO);

assertThat(ce1.getCauses()).containsExactly(IAE, IO, OUPS);
assertThat(ce1.getSuppressed()).containsExactly(IO, OUPS);
Expand All @@ -43,8 +43,8 @@ public void testCreationWithList() {
CompositeException ce2 = new CompositeException(Arrays.asList(IO, IAE, OUPS));
assertThat(ce1).hasMessageContaining("iae").hasMessageContaining("io").hasMessageContaining("oups");

assertThat(ce1).getCause().isEqualTo(IAE);
assertThat(ce2).getCause().isEqualTo(IO);
assertThat(ce1).cause().isEqualTo(IAE);
assertThat(ce2).cause().isEqualTo(IO);

assertThat(ce1.getCauses()).containsExactly(IAE, IO, OUPS);
assertThat(ce1.getSuppressed()).containsExactly(IO, OUPS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void testRetryWithBackOffReachingMaxAttempt() {
.onFailure().retry().withBackOff(Duration.ofMillis(10), Duration.ofSeconds(20)).withJitter(1.0)
.atMost(4)
.await().atMost(Duration.ofSeconds(5));
}).getCause() // Expected exception is wrapped in a java.util.concurrent.CompletionException
}).cause() // Expected exception is wrapped in a java.util.concurrent.CompletionException
.hasMessageContaining("boom")
.hasSuppressedException(new IllegalStateException("Retries exhausted: 4/4"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,26 @@ public void testAssertItemsMessages() {

subscriber.assertItems("a", "b", "c");

String m1 = "\nExpected to have received exactly:\n" +
"<a,b,c,d>\n" +
"but received:\n" +
"<a,b,c>.\n" +
"Mismatches are:\n" +
"\t- Missing expected item <d>";
String m1 = """

Expected to have received exactly:
<a,b,c,d>
but received:
<a,b,c>.
Mismatches are:
\t- Missing expected item <d>""";
assertThatThrownBy(() -> subscriber.assertItems("a", "b", "c", "d"))
.isInstanceOf(AssertionError.class)
.hasMessage(m1);

String m2 = "\nExpected to have received exactly\n" +
"<a,b>\n" +
"but received\n" +
"<a,b,c>.\n" +
"The following items were not expected:\n" +
"<c>";
String m2 = """

Expected to have received exactly
<a,b>
but received
<a,b,c>.
The following items were not expected:
<c>""";
assertThatThrownBy(() -> subscriber.assertItems("a", "b"))
.isInstanceOf(AssertionError.class)
.hasMessage(m2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ public String toString() {
}

public boolean equals(Object object) {
if (object instanceof TestObject) {
TestObject test = (TestObject) object;
if (object instanceof TestObject test) {
return test.key.equals(this.key) &&
test.value.equals(this.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void testWithFailureCollectionWithMerge() {
public void failureMustTriggerCancellations() {
AtomicBoolean firstCancelled = new AtomicBoolean();
Multi<Integer> first = Multi.createBy().repeating().uni(
() -> Uni.createFrom().item(123).onItem().delayIt().by(Duration.ofSeconds(5))).atMost(10l)
() -> Uni.createFrom().item(123).onItem().delayIt().by(Duration.ofSeconds(5))).atMost(10L)
.onCancellation().invoke(() -> firstCancelled.set(true));
Multi<Integer> second = Multi.createFrom().failure(new IOException("boom"));
AssertSubscriber<Integer> sub = Multi.createBy().merging().streams(first, second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public void testActionsOnTerminationWithFailure() {

subscriber.assertFailed().assertFailedWith(CompositeException.class, "boom");
CompositeException compositeException = (CompositeException) subscriber.getFailure();
assertThat(compositeException).getRootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException).rootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException.getCauses().get(1)).isInstanceOf(IOException.class).hasMessageContaining("tada");
assertThat(Item).doesNotHaveValue(1);
assertThat(subscription.get()).isNotNull();
Expand Down Expand Up @@ -590,7 +590,7 @@ public void testActionsOnTerminationWithSupplierOnFailure() {

subscriber.assertFailed().assertFailedWith(CompositeException.class, "boom");
CompositeException compositeException = (CompositeException) subscriber.getFailure();
assertThat(compositeException).getRootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException).rootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException.getCauses().get(1)).isInstanceOf(IOException.class).hasMessageContaining("tada");
assertThat(Item).doesNotHaveValue(1);
assertThat(subscription.get()).isNotNull();
Expand All @@ -615,7 +615,7 @@ public void testActionsOnTerminationWithMapperThrowingException() {

subscriber.assertFailed().assertFailedWith(CompositeException.class, "boom");
CompositeException compositeException = (CompositeException) subscriber.getFailure();
assertThat(compositeException).getRootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException).rootCause().isInstanceOf(IOException.class).hasMessageContaining("boom");
assertThat(compositeException.getCauses().get(1)).isInstanceOf(RuntimeException.class).hasMessageContaining("tada");
assertThat(Item).doesNotHaveValue(1);
assertThat(subscription.get()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void oneIsNull() {
}

@Nested
@SuppressWarnings("ResultOfMethodCallIgnored")
@SuppressWarnings({ "ResultOfMethodCallIgnored", "unchecked" })
class Emptyness {
@Test
void emptyArraysJoinFirst() {
Expand Down
Loading