Adjust timing for the WebsocketConsumerTests

This commit is contained in:
Artem Bilan
2024-10-03 12:07:32 -04:00
parent 2b4cb9e151
commit af672f3374
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,8 +50,8 @@ public class WebsocketConsumerClientHandler extends AbstractWebSocketHandler {
latch.countDown();
}
public void await() throws InterruptedException {
latch.await(timeout, TimeUnit.MILLISECONDS);
public boolean await() throws InterruptedException {
return latch.await(timeout, TimeUnit.MILLISECONDS);
}
public List<String> getReceivedMessages() {

View File

@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
public class WebsocketConsumerTests {
public static final int TIMEOUT = 10000;
public static final int TIMEOUT = 20000;
public static final int MESSAGE_COUNT = 100;
@@ -80,7 +80,7 @@ public class WebsocketConsumerTests {
doHandshake(handler);
List<String> messagesToSend = submitMultipleMessages(MESSAGE_COUNT);
handler.await();
assertThat(handler.await()).isTrue();
assertThat(handler.getReceivedMessages().size()).isEqualTo(MESSAGE_COUNT);
messagesToSend.forEach((s) -> assertThat(handler.getReceivedMessages().contains(s)).isTrue());