From c97d9b0d475ac8a21be12c4973e1b50d7fa91573 Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Thu, 8 Feb 2024 19:49:47 +0100 Subject: [PATCH] test_ClientHandlerConstructorTest --- .../java/ClientHandlerConstructorTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/java/ClientHandlerConstructorTest.java diff --git a/src/test/java/ClientHandlerConstructorTest.java b/src/test/java/ClientHandlerConstructorTest.java new file mode 100644 index 0000000..7ebe7ce --- /dev/null +++ b/src/test/java/ClientHandlerConstructorTest.java @@ -0,0 +1,27 @@ +import static org.junit.Assert.*; +import org.junit.Test; +import java.io.*; +import java.net.*; + +public class ClientHandlerConstructorTest { + + @Test + + public void testConstructor() { + Socket mockSocket = new Socket(); + + + int port = 12345; + + + ChatServer mockChatServer = new ChatServer(port); + + + ClientHandler clientHandler = new ClientHandler(mockChatServer, mockSocket); + + + + + assertTrue(mockChatServer.getClients().contains(clientHandler)); + } +}