Adjust timing for the WebsocketConsumerTests
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user