added minor changes

This commit is contained in:
Benjamin Feyer
2024-12-01 21:53:38 +01:00
parent 1c826bcec0
commit 6370ec15c2
2 changed files with 24 additions and 9 deletions

View File

@@ -10,6 +10,7 @@
import pp.mdga.client.gameState.turnState.choosePieceState.*; import pp.mdga.client.gameState.turnState.choosePieceState.*;
import pp.mdga.client.gameState.turnState.powerCardState.*; import pp.mdga.client.gameState.turnState.powerCardState.*;
import pp.mdga.game.Game; import pp.mdga.game.Game;
import pp.mdga.game.Player;
import pp.mdga.message.server.*; import pp.mdga.message.server.*;
import pp.mdga.game.BonusCard; import pp.mdga.game.BonusCard;
import pp.mdga.game.Color; import pp.mdga.game.Color;
@@ -103,6 +104,9 @@ public class ClientStateTest {
private BonusCard shieldCard; private BonusCard shieldCard;
private BonusCard turboCard; private BonusCard turboCard;
//declare a player
private Player player;
@Before @Before
public void setUp() { public void setUp() {
//initialize the game //initialize the game
@@ -116,6 +120,11 @@ public void send(ClientMessage msg) {
} }
}); });
//initialize a player
player = new Player(name);
//todo piece
//initialize the playerID //initialize the playerID
from = 1234; from = 1234;
name = "Daniel"; name = "Daniel";
@@ -136,13 +145,13 @@ public void send(ClientMessage msg) {
endOfTurn = new EndOfTurnMessage(); endOfTurn = new EndOfTurnMessage();
lobbyAccept = new LobbyAcceptMessage(); lobbyAccept = new LobbyAcceptMessage();
lobbyDeny = new LobbyDenyMessage(); lobbyDeny = new LobbyDenyMessage();
lobbyPlayerJoin = new LobbyPlayerJoinedMessage(from,name); lobbyPlayerJoin = new LobbyPlayerJoinedMessage(from,player);
lobbyPlayerLeave = new LobbyPlayerLeaveMessage(from, color); lobbyPlayerLeave = new LobbyPlayerLeaveMessage(from);
moveMessage = new MoveMessage("www",false, 20);//Todo moveMessage = new MoveMessage(,false, 20);//Todo
noTurn = new NoTurnMessage(); noTurn = new NoTurnMessage();
interruptMessage = new PauseGameMessage(); interruptMessage = new PauseGameMessage();
playCardSwap = PlayCardMessage.swap("www", "www");//Todo playCardSwap = PlayCardMessage.swap();//Todo
playCardShield = PlayCardMessage.shield( "www");//Todo playCardShield = PlayCardMessage.shield();//Todo
playCardTurbo = PlayCardMessage.turbo(1);//Todo playCardTurbo = PlayCardMessage.turbo(1);//Todo
possibleCard = new PossibleCardMessage(); possibleCard = new PossibleCardMessage();
possiblePieceShield = PossiblePieceMessage.shieldPossiblePieces(new ArrayList<>()); //TODO possiblePieceShield = PossiblePieceMessage.shieldPossiblePieces(new ArrayList<>()); //TODO
@@ -153,9 +162,9 @@ public void send(ClientMessage msg) {
reconnectBriefing = new ReconnectBriefingMessage(game); reconnectBriefing = new ReconnectBriefingMessage(game);
resumeGame = new ResumeGameMessage(); resumeGame = new ResumeGameMessage();
startGame = new ServerStartGameMessage(); startGame = new ServerStartGameMessage();
startPieceMessage = new StartPieceMessage("www"); //Todo wrong class startPieceMessage = new StartPieceMessage(); //Todo wrong class
updateReady = new UpdateReadyMessage(color, true); updateReady = new UpdateReadyMessage(from, true);
updateTSK = new UpdateTSKMessage(name, color); updateTSK = new UpdateTSKMessage(from, color);
waitPiece = new WaitPieceMessage(); waitPiece = new WaitPieceMessage();
interruptMessage = new PauseGameMessage(); interruptMessage = new PauseGameMessage();
spectatorMessage = new SpectatorMessage(); spectatorMessage = new SpectatorMessage();

View File

@@ -5,6 +5,7 @@
import pp.mdga.message.server.ServerMessage; import pp.mdga.message.server.ServerMessage;
import pp.mdga.server.ServerGameLogic; import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.ServerSender; import pp.mdga.server.ServerSender;
import pp.mdga.server.automaton.GameState;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@@ -123,6 +124,10 @@ public void broadcast(ServerMessage message) {
@Test @Test
public void testMove() { public void testMove() {
// TODO: // TODO:
//sends the server in selectPiece
serverGameLogic.setCurrentState(serverGameLogic.getGameState());
GameState gameState =serverGameLogic.getGameState();
//sets the active Player to host //sets the active Player to host
game.setActiveColor(hostColor); game.setActiveColor(hostColor);
@@ -131,7 +136,8 @@ public void testMove() {
//sends the move-message //sends the move-message
//tests if the piece has moved in the right direction //tests if the piece has moved in the right direction
assertTrue(); assertTrue(game.getBoard().getInfield()[4].isOccupied());
assertEquals(game.getBoard().getInfield()[4].getOccupant(),pieceHost3);
} }
/** /**