From 314019a63290480c30ff36e16cb7069f80c965d6 Mon Sep 17 00:00:00 2001 From: Benjamin Feyer Date: Mon, 2 Dec 2024 04:40:49 +0100 Subject: [PATCH] added one more test-class --- .../src/test/java/pp/mdga/game/PieceTest.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java b/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java index 6911471b..5bf16513 100644 --- a/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java +++ b/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java @@ -540,16 +540,34 @@ public void testShufflePile() { */ @Test public void testEnterHouse() { - // TODO: Implement test logic for entering the house area - //sets the active Player to Client + //sends the server in firstRoll + serverGameLogic.setCurrentState(gameState); + gameState.setCurrentState(turnState); + turnState.setCurrentState(rollDiceState); + rollDiceState.setCurrentState(firstRollState); - //sets the dice-seed to 1 + //tests if the server is in firstRoll + assertEquals(serverGameLogic.getCurrentState(),gameState); + assertEquals(gameState.getCurrentState(), turnState); + assertEquals(turnState.getCurrentState(),rollDiceState); + assertEquals(rollDiceState.getCurrentState(),firstRollState); - //send requestDice-Message + //set activePlayer to client + game.setActiveColor(clientColor); - //sends requestMoveMessage with clientPiece 02 + //set the die in Game to 1 + game.setDie(die1); + + //sends the request-Dice-message + serverGameLogic.received(new RequestDieMessage(),IDClient); + + //sends the requestMove-message for pieceClient1 + serverGameLogic.received(new RequestMoveMessage(pieceClient2.getUuid()),IDClient); //tests, if the piece is in the first slot of the home + assertTrue(game.getBoard().getPlayerData().get(clientColor).getHomeNodes()[0].isOccupied()); + assertEquals(game.getBoard().getPlayerData().get(clientColor).getHomeNodes()[0].getOccupant(),pieceClient2); + assertFalse(game.getBoard().getInfield()[19].isOccupied()); } /** @@ -572,7 +590,7 @@ public void testOnlyEnterOwnHouse() { assertEquals(turnState.getCurrentState(),rollDiceState); assertEquals(rollDiceState.getCurrentState(),firstRollState); - //set activePlayer to client + //set activePlayer to host game.setActiveColor(hostColor); //set the die in Game to 3