Skip to content

Commit ce68b75

Browse files
committed
Check BeforeEach
1 parent b078643 commit ce68b75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/java/org/java_websocket/misc/OpeningHandshakeRejectionTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.java_websocket.util.SocketUtil;
4141
import org.junit.jupiter.api.*;
4242

43+
import static org.junit.jupiter.api.Assertions.assertTrue;
4344
import static org.junit.jupiter.api.Assertions.fail;
4445

4546
public class OpeningHandshakeRejectionTest {
@@ -48,10 +49,13 @@ public class OpeningHandshakeRejectionTest {
4849
private Thread thread;
4950
private ServerSocket serverSocket;
5051

52+
private boolean beforeeach_called;
53+
5154
private static final String additionalHandshake = "Upgrade: websocket\r\nConnection: Upgrade\r\n\r\n";
5255

5356
@BeforeEach()
5457
public void startServer() throws InterruptedException {
58+
5559
port = SocketUtil.getAvailablePort();
5660
thread = new Thread(
5761
() -> {
@@ -135,6 +139,7 @@ public void startServer() throws InterruptedException {
135139
}
136140
});
137141
thread.start();
142+
beforeeach_called = true;
138143
}
139144

140145
@AfterEach
@@ -216,6 +221,7 @@ public void testHandshakeRejectionTestCase11() throws Exception {
216221
}
217222

218223
private void testHandshakeRejection(int i) throws Exception {
224+
assertTrue(beforeeach_called, "BeforeEach is called");
219225
final int finalI = i;
220226
final CountDownLatch countDownLatch = new CountDownLatch(1);
221227
WebSocketClient webSocketClient = new WebSocketClient(

0 commit comments

Comments
 (0)