added some mor testcases for the clientstatemachine

This commit is contained in:
Benjamin Feyer
2024-11-24 18:40:10 +01:00
committed by Felix
parent f3ca9f01c0
commit 1b2d4df96f

View File

@@ -236,7 +236,7 @@ public void testDialogsToClientStateEndState() {
public void testClientGameToCeremony() { public void testClientGameToCeremony() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
@@ -259,7 +259,7 @@ public void testClientGameToCeremony() {
@Test @Test
public void testClientGameSubStatesToInterrupt() { public void testClientGameSubStatesToInterrupt() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
@@ -286,7 +286,7 @@ public void testGameToDialogs() {
public void testStayInInterrupt() { public void testStayInInterrupt() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(interrupt); clientAutomaton.gotoState(interrupt);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof Interrupt); assertTrue(clientAutomaton.getState() instanceof Interrupt);
@@ -301,7 +301,7 @@ public void testStayInInterrupt() {
public void testClientInterruptToGame() { public void testClientInterruptToGame() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(interrupt); clientAutomaton.gotoState(interrupt);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof Interrupt); assertTrue(clientAutomaton.getState() instanceof Interrupt);
@@ -316,7 +316,7 @@ public void testClientInterruptToGame() {
public void testInterruptToDialogs() { public void testInterruptToDialogs() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(interrupt); clientAutomaton.gotoState(interrupt);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof Interrupt); assertTrue(clientAutomaton.getState() instanceof Interrupt);
@@ -331,7 +331,7 @@ public void testInterruptToDialogs() {
public void testCeremonyToDialogs() { public void testCeremonyToDialogs() {
// Todo Implementation goes here // Todo Implementation goes here
//send the client in the ceremony //send the client in the ceremony
clientAutomaton.goto(ceremony); clientAutomaton.gotoState(ceremony);
assertTrue(clientAutomaton.getStates() instanceof Ceremony); assertTrue(clientAutomaton.getStates() instanceof Ceremony);
//Todo //Todo
@@ -418,7 +418,7 @@ public void testLobbyToRollRankingDice() {
assertTrue(clientAutomaton.getState() instanceof Dialogs); assertTrue(clientAutomaton.getState() instanceof Dialogs);
Dialogs dialogs1 = (Dialogs) clientAutomaton.getState(); Dialogs dialogs1 = (Dialogs) clientAutomaton.getState();
DialogsStateMachine dialogsStateMachine1 = lobby.getDialogsStatemachine(); DialogsStateMachine dialogsStateMachine1 = lobby.getDialogsStatemachine();
dialogsStateMachine1.goto(lobby); dialogsStateMachine1.gotoState(lobby);
assertTrue(dialogsStateMachine1.getState() instanceof Lobby); assertTrue(dialogsStateMachine1.getState() instanceof Lobby);
//sends the message to start the game //sends the message to start the game
@@ -453,14 +453,14 @@ public void testDetermineStartPlayerToWait() {
public void testWaitToAnimation() { public void testWaitToAnimation() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
//tests if the client is in GameState //tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the client in WaitState //sends the client in WaitState
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(waiting); gameStateMachine1.gotoState(waiting);
assertTrue(gameStateMachine1.getState() instanceof Waiting); assertTrue(gameStateMachine1.getState() instanceof Waiting);
//tests if a piece is moved,that the client goes into Animation //tests if a piece is moved,that the client goes into Animation
@@ -468,7 +468,7 @@ public void testWaitToAnimation() {
assertTrue(gameStateMachine1.getState() instanceof Animation); assertTrue(gameStateMachine1.getState() instanceof Animation);
//sends the client in WaitState //sends the client in WaitState
gameStateMachine1.goto(waiting); gameStateMachine1.gotoState(waiting);
assertTrue(gameStateMachine1.getState() instanceof Waiting); assertTrue(gameStateMachine1.getState() instanceof Waiting);
//tests if a powerCard is played,that the client goes into Animation //tests if a powerCard is played,that the client goes into Animation
@@ -476,7 +476,7 @@ public void testWaitToAnimation() {
assertTrue(gameStateMachine1.getState() instanceof Animation); assertTrue(gameStateMachine1.getState() instanceof Animation);
//sends the client in WaitState //sends the client in WaitState
gameStateMachine1.goto(waiting); gameStateMachine1.gotoState(waiting);
assertTrue(gameStateMachine1.getState() instanceof Waiting); assertTrue(gameStateMachine1.getState() instanceof Waiting);
//tests if a die is rolled,that the client goes into Animation //tests if a die is rolled,that the client goes into Animation
@@ -491,12 +491,12 @@ public void testWaitToAnimation() {
public void testWaitToTurn() { public void testWaitToTurn() {
//TODo //TODo
//sends client in gameState //sends client in gameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(wait); gameStateMachine1.gotoState(wait);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//the client receives the message ActivePlayer //the client receives the message ActivePlayer
@@ -577,17 +577,17 @@ public void testPowerCardSubStatesToRollDice() {
public void testStayInPlayPowerCard() { public void testStayInPlayPowerCard() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PlayPowerCard //sends the turnStatemachine in PlayPowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(playPowerCard); turnStateMachine1.gotoState(playPowerCard);
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard); assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
//Todo send messages to test to stay in playPowerCard //Todo send messages to test to stay in playPowerCard
@@ -601,17 +601,17 @@ public void testStayInPlayPowerCard() {
public void testPlayPowerCardToRollDice() { public void testPlayPowerCardToRollDice() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PlayPowerCard //sends the turnStatemachine in PlayPowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(playPowerCard); turnStateMachine1.gotoState(playPowerCard);
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard); assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
//Todo send messages to test the transition in rollDice //Todo send messages to test the transition in rollDice
@@ -696,7 +696,31 @@ public void testStayInChoosePowerCard() {
*/ */
@Test @Test
public void testChoosePowerCardToRollDice() { public void testChoosePowerCardToRollDice() {
// Implementation goes here
//TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in ChoosePiece
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(choosePowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof ChoosePowerCard);
//todo send the messages, to force a state change to rollDice
//tests if the turnStateMachine is in RollDice
assertTrue(turnStateMachine1.getState() instanceof RollDice);
} }
/** /**
@@ -704,7 +728,31 @@ public void testChoosePowerCardToRollDice() {
*/ */
@Test @Test
public void testChoosePowerCardToSwap() { public void testChoosePowerCardToSwap() {
// Implementation goes here //TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in ChoosePiece
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(choosePowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof ChoosePowerCard);
//todo send the messages, to force a state change to swap
//tests if the client is in Swap
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof Swap);
} }
/** /**
@@ -712,7 +760,31 @@ public void testChoosePowerCardToSwap() {
*/ */
@Test @Test
public void testChoosePowerCardToShield() { public void testChoosePowerCardToShield() {
// Implementation goes here //TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in ChoosePiece
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(choosePowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof ChoosePowerCard);
//todo send the messages, to force a state change to shield
//tests if the client is in Shield
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof Shield);
} }
/** /**
@@ -720,7 +792,31 @@ public void testChoosePowerCardToShield() {
*/ */
@Test @Test
public void testStayInShield() { public void testStayInShield() {
// Implementation goes here //TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in Shield
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(shield);
assertTrue(powerCardStateMachine1.getState() instanceof Shield);
//todo send the messages, which dont force a statechange
//tests if the client is in PlayPowerCard
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine1.getState() instanceof PlayPowerCard);
} }
/** /**
@@ -728,7 +824,30 @@ public void testStayInShield() {
*/ */
@Test @Test
public void testShieldToPowerCardEndState() { public void testShieldToPowerCardEndState() {
// Implementation goes here //TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in Shield
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(shield);
assertTrue(powerCardStateMachine1.getState() instanceof Shield);
//todo send the message to force the statechange
//tests if the client is in PlayPowerCard
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
} }
/** /**
@@ -736,7 +855,30 @@ public void testShieldToPowerCardEndState() {
*/ */
@Test @Test
public void testSwapToPowerCardEndState() { public void testSwapToPowerCardEndState() {
// Implementation goes here //TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in PowerCard
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.gotoState(powerCard);
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
//sends the turnStatemachine in Swap
PowerCardStateMachine powerCardStateMachine1 = powerCard.getPowerCardStateMachine();
powerCardStateMachine1.gotoState(swap);
assertTrue(powerCardStateMachine1.getState() instanceof Swap);
//todo send the message to force the statechange
//tests if the client is in PlayPowerCard
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
} }
/** /**
@@ -746,17 +888,17 @@ public void testSwapToPowerCardEndState() {
public void testNoPieceInWaitingPiece() { public void testNoPieceInWaitingPiece() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in NoPiece //sends the choosePieceStatemachine in NoPiece
@@ -778,17 +920,17 @@ public void testNoPieceInWaitingPiece() {
public void testNoPieceInSelectedPiece() { public void testNoPieceInSelectedPiece() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in NoPiece //sends the choosePieceStatemachine in NoPiece
@@ -810,17 +952,17 @@ public void testNoPieceInSelectedPiece() {
public void testNoPieceInStartPiece() { public void testNoPieceInStartPiece() {
//TODO //TODO
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in NoPiece //sends the choosePieceStatemachine in NoPiece
@@ -842,17 +984,17 @@ public void testNoPieceInStartPiece() {
public void testNoPieceInWait() { public void testNoPieceInWait() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in NoPiece //sends the choosePieceStatemachine in NoPiece
@@ -873,22 +1015,22 @@ public void testNoPieceInWait() {
@Test @Test
public void testStayInWaitingPiece() { public void testStayInWaitingPiece() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in WaitingPiece //sends the choosePieceStatemachine in WaitingPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(waitingPiece); choosePieceStateMachine1.gotoState(waitingPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece); assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
//TODO send all sever-messages except ... to the clientGameLogic to test there are no state change //TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
@@ -902,22 +1044,22 @@ public void testStayInWaitingPiece() {
@Test @Test
public void testWaitingPieceInChoosePieceEndState() { public void testWaitingPieceInChoosePieceEndState() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in WaitingPiece //sends the choosePieceStatemachine in WaitingPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(waitingPiece); choosePieceStateMachine1.gotoState(waitingPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece); assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
//Todo send the message to the clientGameLogic to force a state change //Todo send the message to the clientGameLogic to force a state change
@@ -931,22 +1073,22 @@ public void testWaitingPieceInChoosePieceEndState() {
@Test @Test
public void testStayInSelectedPiece() { public void testStayInSelectedPiece() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in SelectPiece //sends the choosePieceStatemachine in SelectPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(selectPiece); choosePieceStateMachine1.gotoState(selectPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece); assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
//Todo send all server messages which dont force a state change here //Todo send all server messages which dont force a state change here
@@ -960,22 +1102,22 @@ public void testStayInSelectedPiece() {
@Test @Test
public void testSelectedPieceInChoosePieceEndState() { public void testSelectedPieceInChoosePieceEndState() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in SelectPiece //sends the choosePieceStatemachine in SelectPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(selectPiece); choosePieceStateMachine1.gotoState(selectPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece); assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
//Todo send the message which force a state change //Todo send the message which force a state change
@@ -989,22 +1131,22 @@ public void testSelectedPieceInChoosePieceEndState() {
@Test @Test
public void testStayInStartPiece() { public void testStayInStartPiece() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in StartPiece //sends the choosePieceStatemachine in StartPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(startPiece); choosePieceStateMachine1.gotoState(startPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece); assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
//todo send all messages which dont force a state change //todo send all messages which dont force a state change
@@ -1018,22 +1160,22 @@ public void testStayInStartPiece() {
@Test @Test
public void testStartPieceToChoosePieceEndState() { public void testStartPieceToChoosePieceEndState() {
//sends the ClientAutomaton in GameState //sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState); clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn //sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine(); GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn); gameStateMachine1.gotoState(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn); assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece //sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine(); TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece); turnStateMachine1.gotoState(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece); assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in StartPiece //sends the choosePieceStatemachine in StartPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine(); ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(startPiece); choosePieceStateMachine1.gotoState(startPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece); assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
//Todo send the message which force a state change //Todo send the message which force a state change