This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 69a3375cdec191f2216557e7ae91fa1664ce853b Author: Benoit Tellier <[email protected]> AuthorDate: Tue Aug 11 16:04:00 2020 +0700 JAMES-3308 RabbitMQTerminationSubscriberTest should be thread safe We should enforce the use of thread safe collections to prevent unlikely runtime failures (ConcurrentModificationException) --- .../distributed/RabbitMQTerminationSubscriberTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/task/task-distributed/src/test/java/org/apache/james/task/eventsourcing/distributed/RabbitMQTerminationSubscriberTest.java b/server/task/task-distributed/src/test/java/org/apache/james/task/eventsourcing/distributed/RabbitMQTerminationSubscriberTest.java index 87bee6e..482035f 100644 --- a/server/task/task-distributed/src/test/java/org/apache/james/task/eventsourcing/distributed/RabbitMQTerminationSubscriberTest.java +++ b/server/task/task-distributed/src/test/java/org/apache/james/task/eventsourcing/distributed/RabbitMQTerminationSubscriberTest.java @@ -31,8 +31,10 @@ import static org.awaitility.Duration.TEN_SECONDS; import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.stream.IntStream; import org.apache.james.backends.rabbitmq.RabbitMQExtension; @@ -123,12 +125,11 @@ class RabbitMQTerminationSubscriberTest implements TerminationSubscriberContract sendEvents(subscriber1, COMPLETED_EVENT); - List<Event> receivedEventsFirst = new ArrayList<>(); + Collection<Event> receivedEventsFirst = new ConcurrentLinkedQueue<>(); firstListener.subscribe(receivedEventsFirst::add); await().atMost(ONE_MINUTE).untilAsserted(() -> - SoftAssertions.assertSoftly(soft -> { - assertThat(receivedEventsFirst).containsExactly(COMPLETED_EVENT); - })); + SoftAssertions.assertSoftly(soft -> + assertThat(receivedEventsFirst).containsExactly(COMPLETED_EVENT))); } } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
