added tests in the serverStateTest
added the testmethods for rolldice and movepiece
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
import pp.mdga.server.ServerGameLogic;
|
||||
import pp.mdga.server.ServerSender;
|
||||
import pp.mdga.server.NoTurn;
|
||||
import pp.mdga.server.ServerState;
|
||||
import pp.mdga.server.StartPiece;
|
||||
import pp.mdga.server.ThirdRoll;
|
||||
import pp.mdga.server.Turn;
|
||||
@@ -507,7 +506,23 @@ public void testPlayPowerCardToRollDice() {
|
||||
*/
|
||||
@Test
|
||||
public void testChoosePieceToMovePiece() {
|
||||
// UC-ServerState-19
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in ChoosePiece
|
||||
turnStateMachine.gotoState(choosePiece);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
|
||||
//Todo ???
|
||||
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,8 +530,22 @@ public void testChoosePieceToMovePiece() {
|
||||
* UC-ServerState-20
|
||||
*/
|
||||
@Test
|
||||
public void testMovePiecetoTurnEndState() {
|
||||
// UC-ServerState-20
|
||||
public void testMovePieceToTurnEndState() {
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in MovePiece
|
||||
turnStateMachine.gotoState(movePiece);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
|
||||
//Todo no 6 was rolled, so the server looks, if there are 2 or less player are still in the game
|
||||
//TODO
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,7 +554,26 @@ public void testMovePiecetoTurnEndState() {
|
||||
*/
|
||||
@Test
|
||||
public void testMovePieceToFirstRoll() {
|
||||
// UC-ServerState-21
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in MovePiece
|
||||
turnStateMachine.gotoState(movePiece);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
|
||||
//Todo the player rolled a 6 and the player is not finished
|
||||
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
RollDice rollDice = (RollDice) turnStateMachine.getState();
|
||||
RollDiceMachine rollDiceMachine1 = rollDice.getRollDiceStateMachine();
|
||||
assertTrue(rollDiceMachine1.getState() instanceof FirstRoll);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -534,7 +582,23 @@ public void testMovePieceToFirstRoll() {
|
||||
*/
|
||||
@Test
|
||||
public void testFirstRollToRollDiceEndState() {
|
||||
// UC-ServerState-22
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in RollDice
|
||||
turnStateMachine.gotoState(rollDice);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
|
||||
//sends the RollDiceMachine in FirstRoll
|
||||
rollDiceMachine.gotoState(firstRoll);
|
||||
assertTrue(rollDiceMachine.getState() instanceof FirstRoll);
|
||||
|
||||
//TODO 2 Möglichkeiten
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -543,7 +607,29 @@ public void testFirstRollToRollDiceEndState() {
|
||||
*/
|
||||
@Test
|
||||
public void testFirstRollToSecondRoll() {
|
||||
// UC-ServerState-23
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in RollDice
|
||||
turnStateMachine.gotoState(rollDice);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
|
||||
//sends the RollDiceMachine in FirstRoll
|
||||
rollDiceMachine.gotoState(firstRoll);
|
||||
assertTrue(rollDiceMachine.getState() instanceof FirstRoll);
|
||||
|
||||
//Todo player has no figures to move and had no 6
|
||||
|
||||
//tests if the server is in the SecondRoll
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
assertTrue(rollDiceMachine.getState() instanceof SecondRoll);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -561,7 +647,29 @@ public void testSecondRollToRollDiceEndState() {
|
||||
*/
|
||||
@Test
|
||||
public void testSecondRollToThirdRoll() {
|
||||
// UC-ServerState-25
|
||||
//sends the server in Game-State
|
||||
serverAutomaton.gotoState(gameState);
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
|
||||
//sends the TurnStateMachine in RollDice
|
||||
turnStateMachine.gotoState(rollDice);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
|
||||
//sends the RollDiceMachine in FirstRoll
|
||||
rollDiceMachine.gotoState(firstRoll);
|
||||
assertTrue(rollDiceMachine.getState() instanceof FirstRoll);
|
||||
|
||||
//Todo player has no figures to move and had no 6
|
||||
|
||||
//tests if the server is in the ThirdRoll
|
||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
assertTrue(rollDiceMachine.getState() instanceof ThirdRoll);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user