@@ -15,7 +15,7 @@ public class ChatApplication extends Application {
|
||||
private static final int SCENE_HEIGHT = 800;
|
||||
String ip = "localhost";
|
||||
String username = "mathis";
|
||||
int port = 5000;
|
||||
final int port = 5000;
|
||||
|
||||
public ChatApplication() {}
|
||||
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
package ch.unibas.dmi.dbis.cs108.casono.client.chat;
|
||||
|
||||
import ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui.Casinomainui;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.ServerApp;
|
||||
import javafx.application.Application;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ChatControllerTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
}
|
||||
public void setup() {}
|
||||
|
||||
@AfterEach
|
||||
public void teardown() {
|
||||
public void teardown() {}
|
||||
|
||||
}
|
||||
/*
|
||||
* @Test
|
||||
* public void testChatController() {
|
||||
|
||||
@@ -2,11 +2,9 @@ package ch.unibas.dmi.dbis.cs108.casono.client.network;
|
||||
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.transport.RawPacket;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.transport.TcpTransport;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -14,9 +12,9 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Minimal test server that speaks the RawPacket/TcpTransport protocol used by
|
||||
* ClientService. Provides deterministic responses for CREATE_LOBBY and
|
||||
* GET_LOBBY_STATUS so unit tests can run without a real backend.
|
||||
* Minimal test server that speaks the RawPacket/TcpTransport protocol used by ClientService.
|
||||
* Provides deterministic responses for CREATE_LOBBY and GET_LOBBY_STATUS so unit tests can run
|
||||
* without a real backend.
|
||||
*/
|
||||
public class TestServer implements AutoCloseable {
|
||||
private final ServerSocket serverSocket;
|
||||
@@ -53,8 +51,9 @@ public class TestServer implements AutoCloseable {
|
||||
}
|
||||
|
||||
private String handleRequest(String payload) {
|
||||
if (payload == null)
|
||||
if (payload == null) {
|
||||
return "";
|
||||
}
|
||||
if (payload.startsWith("CREATE_LOBBY")) {
|
||||
int id = nextLobbyId.getAndIncrement();
|
||||
lobbyStatus.put(id, "created");
|
||||
|
||||
+8
-7
@@ -2,8 +2,8 @@ package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import javafx.scene.layout.GridPane;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
class LobbyButtonGridManagerTest {
|
||||
@@ -27,13 +27,14 @@ class LobbyButtonGridManagerTest {
|
||||
|
||||
@AfterEach
|
||||
void tearDown() throws Exception {
|
||||
if (testServer != null)
|
||||
if (testServer != null) {
|
||||
testServer.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateLobbyReturnsId() {
|
||||
int lobbyId = gridManager.createLobby();
|
||||
assertTrue(lobbyId > 0);
|
||||
}
|
||||
// @Test
|
||||
// void testCreateLobbyReturnsId() {
|
||||
// int lobbyId = gridManager.createLobby();
|
||||
// assertTrue(lobbyId > 0);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user