fixed some tests

This commit is contained in:
Benjamin Feyer
2024-12-11 23:32:19 +01:00
parent a3d0056f7f
commit 173cbe31e5
2 changed files with 23 additions and 9 deletions

View File

@@ -115,4 +115,8 @@ public void setIsDied(boolean isDied) {
public void setMoveablePieces(List<Piece> moveablePieces) {
this.moveablePieces = moveablePieces;
}
public void addMovablePieces(Piece piece){
moveablePieces.add(piece);
}
}

View File

@@ -191,10 +191,10 @@ public void shutdown() {
//declare pieces of host here
pieceClient0 = game.getPlayerByColor(hostColor).getWaitingArea()[0];
pieceClient1 = game.getPlayerByColor(hostColor).getWaitingArea()[1];
pieceClient2 = game.getPlayerByColor(hostColor).getWaitingArea()[2];
pieceClient3 = game.getPlayerByColor(hostColor).getWaitingArea()[3];
pieceHost0 = game.getPlayerByColor(hostColor).getWaitingArea()[0];
pieceHost1 = game.getPlayerByColor(hostColor).getWaitingArea()[1];
pieceHost2 = game.getPlayerByColor(hostColor).getWaitingArea()[2];
pieceHost3 = game.getPlayerByColor(hostColor).getWaitingArea()[3];
//clear waiting-area of Client
for (int i = 0; i < 4; i++) {
@@ -211,23 +211,32 @@ public void shutdown() {
for (int i = 0; i < 4; i++) {
game.getPlayerByColor(cyberColor).getWaitingArea()[i] = null;
}
PieceState active = PieceState.ACTIVE;
PieceState home = PieceState.HOME;
//set the Client-pieces here
game.getBoard().setPieceOnBoard(25, pieceClient0); //for UC 02, 03.01, 14,4
pieceClient0.setState(active);
game.getPlayerByColor(clientColor).setPieceInHome(1, pieceClient1);//set piece in Home at 2 slot for UC 18,12,13,11
pieceClient1.setState(home);
game.getBoard().setPieceOnBoard(19, pieceClient2); //for UC 13, 15
pieceClient2.setState(active);
//game.getBoard().setPieceOnBoard(); //todo
//set the host-pieces here
game.getBoard().setPieceOnBoard(28, pieceHost0); //for UC 02,14 ,15, 03.01,4
pieceHost0.setState(active);
game.getBoard().setPieceOnBoard(18, pieceHost1); //for UC 1, 10, 17, 16
pieceHost1.setState(active);
game.getPlayerByColor(hostColor).addWaitingPiece(pieceClient2);//set in waitingArea fur uc 5
game.getBoard().setPieceOnBoard(0, pieceHost3); //for uc 9
pieceHost3.setState(active);
//set the pieces of cyber
game.getBoard().setPieceOnBoard(10,pieceCyber0); // for UC 6,7,8
pieceCyber0.setState(active);
game.getBoard().setPieceOnBoard(12,pieceCyber1); //
pieceCyber1.setState(active);
game.getPlayerByColor(cyberColor).addWaitingPiece(pieceClient3); //for uc 7
//game..... todo
@@ -277,7 +286,6 @@ public void testMove() {
assertEquals(rollDiceState.getCurrentState(),firstRollState);
//sets the die-class, to roll 4's
Die die = new Die(6);
game.setDie(die4);
//sends the request-die-message
@@ -753,6 +761,10 @@ public void testNoPowerCards() {
*/
@Test
public void testShufflePile() {
//sets the active Player to Host
game.setActiveColor(hostColor);
//sends the server in firstRoll
serverGameLogic.setCurrentState(gameState);
gameState.setCurrentState(turnState);
@@ -765,11 +777,9 @@ public void testShufflePile() {
assertEquals(turnState.getCurrentState(),rollDiceState);
assertEquals(rollDiceState.getCurrentState(),firstRollState);
//sets the active Player to Host
game.setActiveColor(hostColor);
//sets the dice-seed to 4
game.setDie(die4);
firstRollState.setIsDied(true);
//sets the discard pile empty
game.setDiscardPile(game.getDrawPile());