added some testmethods and corrected other in the clientStatemachineTests
This commit is contained in:
@@ -191,8 +191,10 @@ public void setUp() {
|
||||
public void testInitialStateClientState() {
|
||||
//tests if the clientAutomaton is in Dialogs
|
||||
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||
Dialogs dialogs = (Dialogs) clientAutomaton.getState();
|
||||
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||
//tests if the statemachine is in StartDialog
|
||||
assertTrue(dialogsStateMachine.getState() instanceof StartDialog);
|
||||
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,8 +202,8 @@ public void testInitialStateClientState() {
|
||||
*/
|
||||
@Test
|
||||
public void testDialogsToGame() {
|
||||
//TODO
|
||||
//tests if the client is in Dialogs
|
||||
clientAutomaton.gotoState(dialogs);
|
||||
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||
|
||||
//sends the startGame-Message to the client
|
||||
@@ -212,12 +214,12 @@ public void testDialogsToGame() {
|
||||
|
||||
//tests if the new State of the GameStateMachine is in DetermineStartPlayer
|
||||
GameState gameState1 = clientAutomaton.getState();
|
||||
GameStateMachine gameStateMachine1 = (GameStateMachine) gameState1.getState();
|
||||
GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
|
||||
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
|
||||
|
||||
//tests if the new State of DetermineStartPlayer is RollRankingDice
|
||||
DetermineStartPlayer determineStartPlayer1=(DetermineStartPlayer) gameStateMachine1.getState();
|
||||
DetermineStartPlayerStateMachine determineStartPlayerStateMachine1 = (DetermineStartPlayerStateMachine) determineStartPlayer1.getState();
|
||||
DetermineStartPlayerStateMachine determineStartPlayerStateMachine1 = determineStartPlayer1.getDetermineStartPlayerStateMachine();
|
||||
assertTrue(DetermineStartPlayerStateMachine.getState() instanceof RollRankingDice);
|
||||
}
|
||||
|
||||
@@ -234,7 +236,6 @@ public void testDialogsToClientStateEndState() {
|
||||
*/
|
||||
@Test
|
||||
public void testClientGameToCeremony() {
|
||||
//TODO
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
|
||||
@@ -249,7 +250,7 @@ public void testClientGameToCeremony() {
|
||||
|
||||
//tests if the state of ceremony is Podium
|
||||
Ceremony ceremony1 = (Ceremony) clientAutomaton.getState();
|
||||
CeremonyStateMachine ceremonyStateMachine1 = (CeremonyStateMachine) ceremony1.getState();
|
||||
CeremonyStateMachine ceremonyStateMachine1 = ceremony1.getCeremonyStateMachine();
|
||||
assertTrue(ceremonyStateMachine1.getState() instanceof Podium);
|
||||
}
|
||||
|
||||
@@ -284,14 +285,15 @@ public void testGameToDialogs() {
|
||||
*/
|
||||
@Test
|
||||
public void testStayInInterrupt() {
|
||||
//TODO
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(interrupt);
|
||||
|
||||
//tests if the client is in GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof Interrupt);
|
||||
|
||||
//Todo
|
||||
//Todo send all messages except the continue-message
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Interrupt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,14 +301,16 @@ public void testStayInInterrupt() {
|
||||
*/
|
||||
@Test
|
||||
public void testClientInterruptToGame() {
|
||||
//TODO
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(interrupt);
|
||||
|
||||
//tests if the client is in GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof Interrupt);
|
||||
|
||||
//Todo
|
||||
//Todo sends the continue-message
|
||||
|
||||
//tests if the client is in the game
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,6 +583,7 @@ public void testWaitToAnimation() {
|
||||
|
||||
//tests if a piece is moved,that the client goes into Animation
|
||||
clientGameLogic.receive(moveMessage); //Todo ??? richtige message
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Animation);
|
||||
|
||||
//sends the client in WaitState
|
||||
@@ -587,6 +592,7 @@ public void testWaitToAnimation() {
|
||||
|
||||
//tests if a powerCard is played,that the client goes into Animation
|
||||
clientGameLogic.receive(playCard); //Todo ??? richtige message
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Animation);
|
||||
|
||||
//sends the client in WaitState
|
||||
@@ -595,6 +601,7 @@ public void testWaitToAnimation() {
|
||||
|
||||
//tests if a die is rolled,that the client goes into Animation
|
||||
clientGameLogic.receive(dice); //Todo ??? richtige message
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Animation);
|
||||
}
|
||||
|
||||
@@ -616,6 +623,9 @@ public void testWaitToTurn() {
|
||||
//the client receives the message ActivePlayer
|
||||
clientGameLogic.receive(activePlayer);
|
||||
|
||||
//tests if the client is in GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//tests if Client is in Turn
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
|
||||
@@ -706,6 +716,11 @@ public void testStayInPlayPowerCard() {
|
||||
|
||||
//Todo send messages to test to stay in playPowerCard
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -731,6 +746,10 @@ public void testPlayPowerCardToRollDice() {
|
||||
//Todo send messages to test the transition in rollDice
|
||||
//Todo test other messages, that there is no state change
|
||||
|
||||
//tests if the client is in RollDice
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof RollDice);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -834,6 +853,8 @@ public void testChoosePowerCardToRollDice() {
|
||||
//todo send the messages, to force a state change to rollDice
|
||||
|
||||
//tests if the turnStateMachine is in RollDice
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof RollDice);
|
||||
}
|
||||
|
||||
@@ -865,6 +886,8 @@ public void testChoosePowerCardToSwap() {
|
||||
//todo send the messages, to force a state change to swap
|
||||
|
||||
//tests if the client is in Swap
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine1.getState() instanceof Swap);
|
||||
}
|
||||
@@ -897,6 +920,8 @@ public void testChoosePowerCardToShield() {
|
||||
//todo send the messages, to force a state change to shield
|
||||
|
||||
//tests if the client is in Shield
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine1.getState() instanceof Shield);
|
||||
}
|
||||
@@ -929,6 +954,8 @@ public void testStayInShield() {
|
||||
//todo send the messages, which dont force a statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine1.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
@@ -961,6 +988,8 @@ public void testShieldToPowerCardEndState() {
|
||||
//todo send the message to force the statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
|
||||
@@ -992,6 +1021,8 @@ public void testSwapToPowerCardEndState() {
|
||||
//todo send the message to force the statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
|
||||
@@ -1024,6 +1055,9 @@ public void testNoPieceInWaitingPiece() {
|
||||
//sends to the clientGameLogic the message WaitPiece
|
||||
clientGameLogic.receive(waitPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
|
||||
}
|
||||
|
||||
@@ -1056,6 +1090,9 @@ public void testNoPieceInSelectedPiece() {
|
||||
//sends to the clientGameLogic the message SelectPiece
|
||||
clientGameLogic.receive(selectPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
|
||||
}
|
||||
|
||||
@@ -1088,6 +1125,9 @@ public void testNoPieceInStartPiece() {
|
||||
//sends to the clientGameLogic the message StartPiece
|
||||
clientGameLogic.receive(startPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
|
||||
}
|
||||
|
||||
@@ -1120,6 +1160,8 @@ public void testNoPieceInWait() {
|
||||
//sends to the clientGameLogic the message NoTurn
|
||||
clientGameLogic.receive(noTurn);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof Waiting);
|
||||
}
|
||||
|
||||
@@ -1149,6 +1191,9 @@ public void testStayInWaitingPiece() {
|
||||
|
||||
//TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
|
||||
}
|
||||
|
||||
@@ -1178,6 +1223,8 @@ public void testWaitingPieceInChoosePieceEndState() {
|
||||
|
||||
//Todo send the message to the clientGameLogic to force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
|
||||
}
|
||||
|
||||
@@ -1207,6 +1254,9 @@ public void testStayInSelectedPiece() {
|
||||
|
||||
//Todo send all server messages which dont force a state change here
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
|
||||
}
|
||||
|
||||
@@ -1236,6 +1286,8 @@ public void testSelectedPieceInChoosePieceEndState() {
|
||||
|
||||
//Todo send the message which force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
|
||||
}
|
||||
|
||||
@@ -1265,6 +1317,9 @@ public void testStayInStartPiece() {
|
||||
|
||||
//todo send all messages which dont force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
|
||||
}
|
||||
|
||||
@@ -1294,6 +1349,8 @@ public void testStartPieceToChoosePieceEndState() {
|
||||
|
||||
//Todo send the message which force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine1.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user