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

View File

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