adjusted some Todos and deleted some mention of statemachines

This commit is contained in:
Benjamin Feyer
2024-12-01 00:35:46 +01:00
parent 0fd190419d
commit c41848b061
2 changed files with 86 additions and 82 deletions

View File

@@ -15,6 +15,7 @@
import pp.mdga.game.BonusCard; import pp.mdga.game.BonusCard;
import pp.mdga.game.Color; import pp.mdga.game.Color;
import pp.mdga.message.client.ClientMessage; import pp.mdga.message.client.ClientMessage;
import java.util.ArrayList; import java.util.ArrayList;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@@ -1313,7 +1314,7 @@ public void testPowerCardSubStatesToPlayPowerCard() {
/** /**
* UC-ClientState-30: Test the transition from PowerCard sub-states to RollDice. * UC-ClientState-30: Test the transition from PowerCard sub-states to RollDice.
* * <p>
* tests the transition from ChoosePowerCard from PowerCard to RollDice * tests the transition from ChoosePowerCard from PowerCard to RollDice
*/ */
@Test @Test
@@ -1572,7 +1573,7 @@ public void testRollDiceToWait() {
/** /**
* UC-ClientState-36: Test the transition from ChoosePiece to Wait. * UC-ClientState-36: Test the transition from ChoosePiece to Wait.
* * <p>
* this method tests the transition from noPiece to Wait * this method tests the transition from noPiece to Wait
*/ */
@Test @Test
@@ -1815,7 +1816,6 @@ public void testStayInChoosePowerCard() {
clientGameLogic.received(waitPiece); clientGameLogic.received(waitPiece);
clientGameLogic.received(spectatorMessage); clientGameLogic.received(spectatorMessage);
clientGameLogic.received(selectPieceMessage); clientGameLogic.received(selectPieceMessage);
//TODO selectable pieces
//tests if the client is still in the choosePowerCard-State //tests if the client is still in the choosePowerCard-State
assertEquals(clientGameLogic.getState(), gameState); assertEquals(clientGameLogic.getState(), gameState);
@@ -2066,7 +2066,8 @@ public void testSwapToPowerCardEndState() {
powerCard.setState(swap); powerCard.setState(swap);
assertEquals(powerCard.getState(), swap); assertEquals(powerCard.getState(), swap);
//todo send the message to force the statechange //sends the playCardMessage
clientGameLogic.received(playCardSwap);
//tests if the client is in PlayPowerCard //tests if the client is in PlayPowerCard
assertEquals(clientGameLogic.getState(), gameState); assertEquals(clientGameLogic.getState(), gameState);

View File

@@ -46,9 +46,9 @@ public class ServerStateTest {
private SelectTSKMessage selectTSK; private SelectTSKMessage selectTSK;
private DisconnectedMessage disconnect; private DisconnectedMessage disconnect;
//declare state-machines here //declare state-States here
//TODO: interrupt and lobby are no state-machines //TODO: interrupt and lobby are no state-States
//declare states here //declare states here
//TODO //TODO
@@ -79,13 +79,13 @@ public class ServerStateTest {
private RollDiceState rollDiceState; private RollDiceState rollDiceState;
private SecondRollState secondRoll; private SecondRollState secondRoll;
private SelectPieceState selectPiece; private SelectPieceState selectPiece;
private StartPieceState startPiece; private StartPieceState startPieceState;
private ThirdRollState thirdRoll; private ThirdRollState thirdRoll;
private TurnState turnState; private TurnState turnState;
private WaitingPieceState waitingPiece; private WaitingPieceState waitingPiece;
/** /**
* TODO initialize the states and machines and messages here * this method is used to initialize the attributes of this test-class
*/ */
@Before @Before
public void setUp() { public void setUp() {
@@ -124,7 +124,7 @@ public void broadcast(ServerMessage message) {
from = 1234; from = 1234;
fromHost = 2345; fromHost = 2345;
//initialize the state-machines here //initialize the states here
thirdRoll = rollDiceState.getThirdRollState(); thirdRoll = rollDiceState.getThirdRollState();
secondRoll = rollDiceState.getSecondRollState(); secondRoll = rollDiceState.getSecondRollState();
firstRollState = rollDiceState.getThirdRollState(); firstRollState = rollDiceState.getThirdRollState();
@@ -132,7 +132,7 @@ public void broadcast(ServerMessage message) {
noPiece = choosePieceState.getNoPieceState(); noPiece = choosePieceState.getNoPieceState();
noTurnState = choosePieceState.getNoTurnState(); noTurnState = choosePieceState.getNoTurnState();
waitingPiece = choosePieceState.getWaitingPieceState(); waitingPiece = choosePieceState.getWaitingPieceState();
startPiece = choosePieceState.getStartPieceState(); startPieceState = choosePieceState.getStartPieceState();
selectPiece =choosePieceState.getSelectPieceState(); selectPiece =choosePieceState.getSelectPieceState();
powerCardState = turnState.getPowerCardState(); powerCardState = turnState.getPowerCardState();
@@ -257,6 +257,9 @@ public void testInterruptToGameContinue() {
//Todo send all other messages except forceContinue //Todo send all other messages except forceContinue
//tests if the server is still in Interrupt
assertEquals(serverGameLogic.getCurrentState(),interruptState);
//sends the continue-message to the server //sends the continue-message to the server
serverGameLogic.received(forceContinueGame, from); serverGameLogic.received(forceContinueGame, from);
@@ -273,7 +276,7 @@ public void testInterruptToGameReconnect() {
serverGameLogic.setCurrentState(interruptState); serverGameLogic.setCurrentState(interruptState);
assertEquals(serverGameLogic.getCurrentState() ,interruptState); assertEquals(serverGameLogic.getCurrentState() ,interruptState);
//todo implement the timer //todo implement the reconnect
//tests if new Stet is in GameState //tests if new Stet is in GameState
assertEquals(serverGameLogic.getCurrentState() ,gameState); assertEquals(serverGameLogic.getCurrentState() ,gameState);
@@ -598,7 +601,7 @@ public void testMovePieceToFirstRoll() {
assertEquals(serverGameLogic.getCurrentState() ,gameState); assertEquals(serverGameLogic.getCurrentState() ,gameState);
assertEquals(gameState.getCurrentState() ,turnState); assertEquals(gameState.getCurrentState() ,turnState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
assertEquals(rollDiceState.getCurrentState() ,firstRollStateState); assertEquals(rollDiceState.getCurrentState() ,firstRollState);
} }
/** /**
@@ -619,9 +622,9 @@ public void testFirstRollToRollDiceEndState() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in FirstRoll //sends the RollDiceState in FirstRoll
rollDiceMachine.setCurrentState(firstRollState); rollDiceState.setCurrentState(firstRollState);
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState); assertEquals(rollDiceState.getCurrentState() ,firstRollState);
//TODO 2 Möglichkeiten //TODO 2 Möglichkeiten
@@ -650,9 +653,9 @@ public void testFirstRollToSecondRoll() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in FirstRoll //sends the RollDiceState in FirstRoll
rollDiceMachine.setCurrentState(firstRollState); rollDiceState.setCurrentState(firstRollState);
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState); assertEquals(rollDiceState.getCurrentState() ,firstRollState);
//Todo player has no figures to move and had no 6 //Todo player has no figures to move and had no 6
@@ -660,7 +663,7 @@ public void testFirstRollToSecondRoll() {
assertEquals(serverGameLogic.getCurrentState() ,gameState); assertEquals(serverGameLogic.getCurrentState() ,gameState);
assertEquals(gameState.getCurrentState() ,turnState); assertEquals(gameState.getCurrentState() ,turnState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState); assertEquals(rollDiceState.getCurrentState() ,secondRollState);
} }
/** /**
@@ -681,9 +684,9 @@ public void testSecondRollToRollDiceEndState() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in SecondRoll //sends the RollDiceState in SecondRoll
rollDiceMachine.setCurrentState(secondRoll); rollDiceState.setCurrentState(secondRoll);
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState); assertEquals(rollDiceState.getCurrentState() ,secondRollState);
//Todo //Todo
@@ -712,9 +715,9 @@ public void testSecondRollToThirdRoll() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in SecondRoll //sends the RollDiceState in SecondRoll
rollDiceMachine.setCurrentState(secondRoll); rollDiceState.setCurrentState(secondRoll);
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState); assertEquals(rollDiceState.getCurrentState() ,secondRollState);
//Todo player has no figures to move and had no 6 //Todo player has no figures to move and had no 6
@@ -722,7 +725,7 @@ public void testSecondRollToThirdRoll() {
assertEquals(serverGameLogic.getCurrentState() ,gameState); assertEquals(serverGameLogic.getCurrentState() ,gameState);
assertEquals(gameState.getCurrentState() ,turnState); assertEquals(gameState.getCurrentState() ,turnState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState); assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
} }
/** /**
@@ -743,9 +746,9 @@ public void testThirdRollToRollDiceEndState() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in ThirdRoll //sends the RollDiceState in ThirdRoll
rollDiceMachine.setCurrentState(thirdRoll); rollDiceState.setCurrentState(thirdRoll);
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState); assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
//Todo //Todo
@@ -774,9 +777,9 @@ public void testThirdRollToTurnEndState() {
turnState.setCurrentState(rollDiceState); turnState.setCurrentState(rollDiceState);
assertEquals(turnState.getCurrentState() ,rollDiceState); assertEquals(turnState.getCurrentState() ,rollDiceState);
//sends the RollDiceMachine in ThirdRoll //sends the RollDiceState in ThirdRoll
rollDiceMachine.setCurrentState(thirdRoll); rollDiceState.setCurrentState(thirdRoll);
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState); assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
//Todo //Todo
} }