|
|
@ -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)); |
|
|
|
} |
|
|
|
} |