added in PieceTest the declaration and initialization of two players

This commit is contained in:
Benjamin Feyer
2024-12-01 14:23:26 +01:00
parent 0d043e4bb4
commit d7b0ac92b8
2 changed files with 74 additions and 1 deletions

View File

@@ -2,14 +2,87 @@
import org.junit.Before;
import org.junit.Test;
import pp.mdga.message.server.ServerMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.ServerSender;
/**
* this test-class tests the testcases T035-T058
*/
public class PieceTest {
//declare game here
private Game game;
//declare server here
private ServerGameLogic serverGameLogic;
//declare player-Client here
private Player playerClient;
private String nameClient = "Client";
private Color clientColor;
//declare pieces of client here
private Piece pieceClient0;
private Piece pieceClient1;
private Piece pieceClient2;
private Piece pieceClient3;
//declare player-host here
private Player playerHost;
private String nameHost = "Host";
private Color hostColor;
//declare pieces of host here
private Piece pieceHost0;
private Piece pieceHost1;
private Piece pieceHost2;
private Piece pieceHost3;
//declare messages here
@Before
public void Setup() {
//initialize game here
game = new Game();
//initialize server here
serverGameLogic = new ServerGameLogic(new ServerSender() {
@Override
public void send(int id, ServerMessage message) {
}
@Override
public void broadcast(ServerMessage message) {
}
},game);
//declare player-Client here
playerClient = new Player(nameClient);
clientColor = Color.ARMY;
//declare pieces of client here
pieceClient0 = new Piece(clientColor,PieceState.ACTIVE,2);
pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,3);
pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,4);
pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,5);
//declare player-host here
playerHost = new Player(nameHost);
hostColor = Color.NAVY;
//declare pieces of host here
pieceHost0 = new Piece(hostColor,PieceState.ACTIVE,6);
pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,7);
pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,8);
pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,9);
//set the Pieces here
//declare messages here
}

View File

@@ -177,7 +177,7 @@ public void broadcast(ServerMessage message) {
playerClientColor = Color.ARMY;
playerClient.setColor(playerClientColor);
playerClient.addHandCards(bonusCardClient);
game.addPlayer(IDPlayerClient,playerClient);
game.addPlayer(IDPlayerClient,playerClient); //TODO random uuid
//initialize a piece for client
IDPiece = 3;