Merge branch '6.1.x'

This commit is contained in:
Stéphane Nicoll 2024-03-26 17:45:25 +01:00
commit bf5b22d64f
9 changed files with 48 additions and 47 deletions

View File

@ -57,7 +57,7 @@ class SimpleThreadScopeTests {
thread2.start(); thread2.start();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> (beans[0] != null) && (beans[1] != null)); .until(() -> (beans[0] != null) && (beans[1] != null));
assertThat(beans[1]).isNotSameAs(beans[0]); assertThat(beans[1]).isNotSameAs(beans[0]);

View File

@ -339,7 +339,7 @@ class AsyncExecutionTests {
context.refresh(); context.refresh();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> listenerCalled == 1); .until(() -> listenerCalled == 1);
context.close(); context.close();
@ -357,7 +357,7 @@ class AsyncExecutionTests {
context.close(); context.close();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> listenerCalled == 2); .until(() -> listenerCalled == 2);
assertThat(listenerConstructed).isEqualTo(1); assertThat(listenerConstructed).isEqualTo(1);
@ -377,7 +377,7 @@ class AsyncExecutionTests {
context.close(); context.close();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> listenerCalled == 2); .until(() -> listenerCalled == 2);
assertThat(listenerConstructed).isEqualTo(2); assertThat(listenerConstructed).isEqualTo(2);

View File

@ -226,7 +226,7 @@ class EnableAsyncTests {
asyncBean.work(); asyncBean.work();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> asyncBean.getThreadOfExecution() != null); .until(() -> asyncBean.getThreadOfExecution() != null);
assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-"); assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-");
@ -244,7 +244,7 @@ class EnableAsyncTests {
asyncBean.work(); asyncBean.work();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> asyncBean.getThreadOfExecution() != null); .until(() -> asyncBean.getThreadOfExecution() != null);
assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-"); assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-");
@ -266,7 +266,7 @@ class EnableAsyncTests {
asyncBean.fail(); asyncBean.fail();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.untilAsserted(() -> exceptionHandler.assertCalledWith(method, UnsupportedOperationException.class)); .untilAsserted(() -> exceptionHandler.assertCalledWith(method, UnsupportedOperationException.class));
ctx.close(); ctx.close();
@ -283,7 +283,7 @@ class EnableAsyncTests {
asyncBean.work(); asyncBean.work();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> asyncBean.getThreadOfExecution() != null); .until(() -> asyncBean.getThreadOfExecution() != null);
assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Post-"); assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Post-");
@ -305,7 +305,7 @@ class EnableAsyncTests {
asyncBean.fail(); asyncBean.fail();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.untilAsserted(() -> exceptionHandler.assertCalledWith(method, UnsupportedOperationException.class)); .untilAsserted(() -> exceptionHandler.assertCalledWith(method, UnsupportedOperationException.class));
ctx.close(); ctx.close();
@ -320,7 +320,7 @@ class EnableAsyncTests {
asyncBean.work(); asyncBean.work();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> asyncBean.getThreadOfExecution() != null); .until(() -> asyncBean.getThreadOfExecution() != null);
assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-"); assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-");
@ -336,7 +336,7 @@ class EnableAsyncTests {
asyncBean.work(); asyncBean.work();
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(500, TimeUnit.MILLISECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> asyncBean.getThreadOfExecution() != null); .until(() -> asyncBean.getThreadOfExecution() != null);
assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-"); assertThat(asyncBean.getThreadOfExecution().getName()).startsWith("Custom-");

View File

@ -89,7 +89,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
executor.execute(task); executor.execute(task);
Awaitility.await() Awaitility.await()
.dontCatchUncaughtExceptions() .dontCatchUncaughtExceptions()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> task.exception.get() != null && task.exception.get().getMessage().equals( .until(() -> task.exception.get() != null && task.exception.get().getMessage().equals(
"TestTask failure for test 'executeFailingRunnable': expectedRunCount:<0>, actualRunCount:<1>")); "TestTask failure for test 'executeFailingRunnable': expectedRunCount:<0>, actualRunCount:<1>"));
@ -133,7 +133,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
future.addCallback(result -> outcome = result, ex -> outcome = ex); future.addCallback(result -> outcome = result, ex -> outcome = ex);
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(future::isDone); .until(future::isDone);
assertThat(outcome).isNull(); assertThat(outcome).isNull();
@ -148,7 +148,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
future.whenComplete(this::storeOutcome); future.whenComplete(this::storeOutcome);
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(future::isDone); .until(future::isDone);
assertThat(outcome).isNull(); assertThat(outcome).isNull();
@ -164,7 +164,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
Awaitility.await() Awaitility.await()
.dontCatchUncaughtExceptions() .dontCatchUncaughtExceptions()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.getClass()).isSameAs(RuntimeException.class); assertThat(outcome.getClass()).isSameAs(RuntimeException.class);
@ -178,7 +178,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
Awaitility.await() Awaitility.await()
.dontCatchUncaughtExceptions() .dontCatchUncaughtExceptions()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.getClass()).isSameAs(CompletionException.class); assertThat(outcome.getClass()).isSameAs(CompletionException.class);
@ -198,7 +198,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
// ignore // ignore
} }
Awaitility.await() Awaitility.await()
.atMost(4, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.untilAsserted(() -> assertThatExceptionOfType(CancellationException.class) .untilAsserted(() -> assertThatExceptionOfType(CancellationException.class)
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS))); .isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
@ -217,7 +217,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
// ignore // ignore
} }
Awaitility.await() Awaitility.await()
.atMost(4, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.untilAsserted(() -> assertThatExceptionOfType(TimeoutException.class) .untilAsserted(() -> assertThatExceptionOfType(TimeoutException.class)
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS))); .isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
@ -253,7 +253,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
// ignore // ignore
} }
Awaitility.await() Awaitility.await()
.atMost(4, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.untilAsserted(() -> assertThatExceptionOfType(CancellationException.class) .untilAsserted(() -> assertThatExceptionOfType(CancellationException.class)
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS))); .isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
@ -268,7 +268,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
future.addCallback(result -> outcome = result, ex -> outcome = ex); future.addCallback(result -> outcome = result, ex -> outcome = ex);
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.toString().substring(0, this.threadNamePrefix.length())).isEqualTo(this.threadNamePrefix); assertThat(outcome.toString().substring(0, this.threadNamePrefix.length())).isEqualTo(this.threadNamePrefix);
@ -284,7 +284,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
// Assert // Assert
Awaitility.await() Awaitility.await()
.dontCatchUncaughtExceptions() .dontCatchUncaughtExceptions()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.getClass()).isSameAs(RuntimeException.class); assertThat(outcome.getClass()).isSameAs(RuntimeException.class);
@ -310,7 +310,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
future.whenComplete(this::storeOutcome); future.whenComplete(this::storeOutcome);
// Assert // Assert
Awaitility.await() Awaitility.await()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.toString().substring(0, this.threadNamePrefix.length())).isEqualTo(this.threadNamePrefix); assertThat(outcome.toString().substring(0, this.threadNamePrefix.length())).isEqualTo(this.threadNamePrefix);
@ -325,7 +325,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
// Assert // Assert
Awaitility.await() Awaitility.await()
.dontCatchUncaughtExceptions() .dontCatchUncaughtExceptions()
.atMost(1, TimeUnit.SECONDS) .atMost(5, TimeUnit.SECONDS)
.pollInterval(10, TimeUnit.MILLISECONDS) .pollInterval(10, TimeUnit.MILLISECONDS)
.until(() -> future.isDone() && outcome != null); .until(() -> future.isDone() && outcome != null);
assertThat(outcome.getClass()).isSameAs(CompletionException.class); assertThat(outcome.getClass()).isSameAs(CompletionException.class);

View File

@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
class ReactiveAdapterRegistryTests { class ReactiveAdapterRegistryTests {
private static final Duration ONE_SECOND = Duration.ofSeconds(1); private static final Duration FIVE_SECONDS = Duration.ofSeconds(5);
private final ReactiveAdapterRegistry registry = ReactiveAdapterRegistry.getSharedInstance(); private final ReactiveAdapterRegistry registry = ReactiveAdapterRegistry.getSharedInstance();
@ -134,7 +134,7 @@ class ReactiveAdapterRegistryTests {
Publisher<Integer> source = io.reactivex.rxjava3.core.Flowable.fromIterable(sequence); Publisher<Integer> source = io.reactivex.rxjava3.core.Flowable.fromIterable(sequence);
Object target = getAdapter(Flux.class).fromPublisher(source); Object target = getAdapter(Flux.class).fromPublisher(source);
assertThat(target).isInstanceOf(Flux.class); assertThat(target).isInstanceOf(Flux.class);
assertThat(((Flux<Integer>) target).collectList().block(ONE_SECOND)).isEqualTo(sequence); assertThat(((Flux<Integer>) target).collectList().block(FIVE_SECONDS)).isEqualTo(sequence);
} }
@Test @Test
@ -142,7 +142,7 @@ class ReactiveAdapterRegistryTests {
Publisher<Integer> source = io.reactivex.rxjava3.core.Flowable.fromArray(1, 2, 3); Publisher<Integer> source = io.reactivex.rxjava3.core.Flowable.fromArray(1, 2, 3);
Object target = getAdapter(Mono.class).fromPublisher(source); Object target = getAdapter(Mono.class).fromPublisher(source);
assertThat(target).isInstanceOf(Mono.class); assertThat(target).isInstanceOf(Mono.class);
assertThat(((Mono<Integer>) target).block(ONE_SECOND)).isEqualTo(Integer.valueOf(1)); assertThat(((Mono<Integer>) target).block(FIVE_SECONDS)).isEqualTo(Integer.valueOf(1));
} }
@Test @Test
@ -152,7 +152,7 @@ class ReactiveAdapterRegistryTests {
Object target = getAdapter(Flow.Publisher.class).fromPublisher(source); Object target = getAdapter(Flow.Publisher.class).fromPublisher(source);
assertThat(target).isInstanceOf(Flow.Publisher.class); assertThat(target).isInstanceOf(Flow.Publisher.class);
assertThat(JdkFlowAdapter.flowPublisherToFlux((Flow.Publisher<Integer>) target) assertThat(JdkFlowAdapter.flowPublisherToFlux((Flow.Publisher<Integer>) target)
.collectList().block(ONE_SECOND)).isEqualTo(sequence); .collectList().block(FIVE_SECONDS)).isEqualTo(sequence);
} }
@Test @Test
@ -169,7 +169,7 @@ class ReactiveAdapterRegistryTests {
future.complete(1); future.complete(1);
Object target = getAdapter(CompletableFuture.class).toPublisher(future); Object target = getAdapter(CompletableFuture.class).toPublisher(future);
assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class); assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class);
assertThat(((Mono<Integer>) target).block(ONE_SECOND)).isEqualTo(Integer.valueOf(1)); assertThat(((Mono<Integer>) target).block(FIVE_SECONDS)).isEqualTo(Integer.valueOf(1));
} }
} }
@ -227,7 +227,7 @@ class ReactiveAdapterRegistryTests {
Object source = io.reactivex.rxjava3.core.Flowable.fromIterable(sequence); Object source = io.reactivex.rxjava3.core.Flowable.fromIterable(sequence);
Object target = getAdapter(io.reactivex.rxjava3.core.Flowable.class).toPublisher(source); Object target = getAdapter(io.reactivex.rxjava3.core.Flowable.class).toPublisher(source);
assertThat(target).as("Expected Flux Publisher: " + target.getClass().getName()).isInstanceOf(Flux.class); assertThat(target).as("Expected Flux Publisher: " + target.getClass().getName()).isInstanceOf(Flux.class);
assertThat(((Flux<Integer>) target).collectList().block(ONE_SECOND)).isEqualTo(sequence); assertThat(((Flux<Integer>) target).collectList().block(FIVE_SECONDS)).isEqualTo(sequence);
} }
@Test @Test
@ -236,7 +236,7 @@ class ReactiveAdapterRegistryTests {
Object source = io.reactivex.rxjava3.core.Observable.fromIterable(sequence); Object source = io.reactivex.rxjava3.core.Observable.fromIterable(sequence);
Object target = getAdapter(io.reactivex.rxjava3.core.Observable.class).toPublisher(source); Object target = getAdapter(io.reactivex.rxjava3.core.Observable.class).toPublisher(source);
assertThat(target).as("Expected Flux Publisher: " + target.getClass().getName()).isInstanceOf(Flux.class); assertThat(target).as("Expected Flux Publisher: " + target.getClass().getName()).isInstanceOf(Flux.class);
assertThat(((Flux<Integer>) target).collectList().block(ONE_SECOND)).isEqualTo(sequence); assertThat(((Flux<Integer>) target).collectList().block(FIVE_SECONDS)).isEqualTo(sequence);
} }
@Test @Test
@ -244,7 +244,7 @@ class ReactiveAdapterRegistryTests {
Object source = io.reactivex.rxjava3.core.Single.just(1); Object source = io.reactivex.rxjava3.core.Single.just(1);
Object target = getAdapter(io.reactivex.rxjava3.core.Single.class).toPublisher(source); Object target = getAdapter(io.reactivex.rxjava3.core.Single.class).toPublisher(source);
assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class); assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class);
assertThat(((Mono<Integer>) target).block(ONE_SECOND)).isEqualTo(Integer.valueOf(1)); assertThat(((Mono<Integer>) target).block(FIVE_SECONDS)).isEqualTo(Integer.valueOf(1));
} }
@Test @Test
@ -252,7 +252,7 @@ class ReactiveAdapterRegistryTests {
Object source = io.reactivex.rxjava3.core.Completable.complete(); Object source = io.reactivex.rxjava3.core.Completable.complete();
Object target = getAdapter(io.reactivex.rxjava3.core.Completable.class).toPublisher(source); Object target = getAdapter(io.reactivex.rxjava3.core.Completable.class).toPublisher(source);
assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class); assertThat(target).as("Expected Mono Publisher: " + target.getClass().getName()).isInstanceOf(Mono.class);
((Mono<Void>) target).block(ONE_SECOND); ((Mono<Void>) target).block(FIVE_SECONDS);
} }
} }
@ -289,7 +289,7 @@ class ReactiveAdapterRegistryTests {
Publisher<Integer> source = Mono.just(1); Publisher<Integer> source = Mono.just(1);
Object target = getAdapter(Uni.class).fromPublisher(source); Object target = getAdapter(Uni.class).fromPublisher(source);
assertThat(target).isInstanceOf(Uni.class); assertThat(target).isInstanceOf(Uni.class);
assertThat(((Uni<Integer>) target).await().atMost(ONE_SECOND)).isEqualTo(Integer.valueOf(1)); assertThat(((Uni<Integer>) target).await().atMost(FIVE_SECONDS)).isEqualTo(Integer.valueOf(1));
} }
@Test @Test
@ -297,7 +297,7 @@ class ReactiveAdapterRegistryTests {
Uni<Integer> source = Uni.createFrom().item(1); Uni<Integer> source = Uni.createFrom().item(1);
Object target = getAdapter(Uni.class).toPublisher(source); Object target = getAdapter(Uni.class).toPublisher(source);
assertThat(target).isInstanceOf(Mono.class); assertThat(target).isInstanceOf(Mono.class);
assertThat(((Mono<Integer>) target).block(ONE_SECOND)).isEqualTo(Integer.valueOf(1)); assertThat(((Mono<Integer>) target).block(FIVE_SECONDS)).isEqualTo(Integer.valueOf(1));
} }
@Test @Test
@ -306,7 +306,7 @@ class ReactiveAdapterRegistryTests {
Publisher<Integer> source = Flux.fromIterable(sequence); Publisher<Integer> source = Flux.fromIterable(sequence);
Object target = getAdapter(Multi.class).fromPublisher(source); Object target = getAdapter(Multi.class).fromPublisher(source);
assertThat(target).isInstanceOf(Multi.class); assertThat(target).isInstanceOf(Multi.class);
assertThat(((Multi<Integer>) target).collect().asList().await().atMost(ONE_SECOND)).isEqualTo(sequence); assertThat(((Multi<Integer>) target).collect().asList().await().atMost(FIVE_SECONDS)).isEqualTo(sequence);
} }
@Test @Test
@ -315,7 +315,7 @@ class ReactiveAdapterRegistryTests {
Multi<Integer> source = Multi.createFrom().iterable(sequence); Multi<Integer> source = Multi.createFrom().iterable(sequence);
Object target = getAdapter(Multi.class).toPublisher(source); Object target = getAdapter(Multi.class).toPublisher(source);
assertThat(target).isInstanceOf(Flux.class); assertThat(target).isInstanceOf(Flux.class);
assertThat(((Flux<Integer>) target).blockLast(ONE_SECOND)).isEqualTo(Integer.valueOf(3)); assertThat(((Flux<Integer>) target).blockLast(FIVE_SECONDS)).isEqualTo(Integer.valueOf(3));
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,11 +16,11 @@
package org.springframework.test.context.junit.jupiter.event; package org.springframework.test.context.junit.jupiter.event;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.awaitility.Durations;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
@ -263,7 +263,7 @@ class JUnitJupiterApplicationEventsIntegrationTests {
void asyncConsumption() { void asyncConsumption() {
context.publishEvent(new CustomEvent("sync")); context.publishEvent(new CustomEvent("sync"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(5, TimeUnit.SECONDS)
.untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,6 @@ import java.util.stream.Stream;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.awaitility.Durations;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.TestInfo;
@ -221,7 +220,7 @@ class ParallelApplicationEventsIntegrationTests {
void asyncConsumption() { void asyncConsumption() {
this.context.publishEvent("asyncConsumption"); this.context.publishEvent("asyncConsumption");
Awaitility.await().atMost(Durations.ONE_SECOND).untilAsserted(() ->// Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(() ->//
assertThat(ApplicationEventsHolder// assertThat(ApplicationEventsHolder//
.getRequiredApplicationEvents()// .getRequiredApplicationEvents()//
.stream()// .stream()//

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,9 +16,10 @@
package org.springframework.test.context.junit4.event; package org.springframework.test.context.junit4.event;
import java.util.concurrent.TimeUnit;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.awaitility.Durations;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName; import org.junit.rules.TestName;
@ -70,7 +71,7 @@ public class JUnit4ApplicationEventsAsyncIntegrationTests {
public void asyncConsumption() { public void asyncConsumption() {
context.publishEvent(new CustomEvent("sync")); context.publishEvent(new CustomEvent("sync"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(5, TimeUnit.SECONDS)
.untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)

View File

@ -16,9 +16,10 @@
package org.springframework.test.context.testng.event; package org.springframework.test.context.testng.event;
import java.util.concurrent.TimeUnit;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.awaitility.Durations;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -64,7 +65,7 @@ class TestNGApplicationEventsAsyncIntegrationTests extends AbstractTestNGSpringC
void asyncConsumption() { void asyncConsumption() {
context.publishEvent(new CustomEvent("asyncConsumption")); context.publishEvent(new CustomEvent("asyncConsumption"));
Awaitility.await().atMost(Durations.ONE_SECOND) Awaitility.await().atMost(5, TimeUnit.SECONDS)
.untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class)) .untilAsserted(() -> assertThat(this.applicationEvents.stream(CustomEvent.class))
.singleElement() .singleElement()
.extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING) .extracting(CustomEvent::getMessage, InstanceOfAssertFactories.STRING)