corrected some testmethods in the serverStateTest,
changed all assertTrue( .... isinstanceof ....) to assertEquals(...,....)
This commit is contained in:
@@ -32,8 +32,6 @@ public class ClientStateTest {
|
|||||||
//declare game here
|
//declare game here
|
||||||
private Game game;
|
private Game game;
|
||||||
|
|
||||||
//declare state-machines here
|
|
||||||
|
|
||||||
//declare states here
|
//declare states here
|
||||||
private Animation animation;
|
private Animation animation;
|
||||||
private AudioSettings audioSettings;
|
private AudioSettings audioSettings;
|
||||||
@@ -181,15 +179,13 @@ public void send(ClientMessage msg) {
|
|||||||
settings = new Settings(clientGameLogic,clientGameLogic);
|
settings = new Settings(clientGameLogic,clientGameLogic);
|
||||||
|
|
||||||
|
|
||||||
//initialize the stateMachines
|
|
||||||
ceremonyState =ceremony.getCeremonyState();
|
ceremonyState =ceremony.getCeremonyState();
|
||||||
choosePiece = choosePiece.getChoosePieceStateMachine();
|
choosePiece = choosePiece.getChoosePieceStateMachine();
|
||||||
determineStartPlayerStateMachine = determineStartPlayer.getDetermineStartPlayerStateMachine();
|
determineStartPlayerStateMachine = determineStartPlayer.getDetermineStartPlayerStateMachine();
|
||||||
dialogs = dialogs.getDialogsState();
|
dialogs = dialogs.getDialogsState();
|
||||||
gameState = gameState.getGameStateMachine();
|
gameState = gameState.getGameStateMachine();
|
||||||
powerCardStateMachine = powerCard.getPowerCardStateMachine();
|
powerCardStateMachine = powerCard.getPowerCardStateMachine();
|
||||||
settingsStateMachine = settings.getSettingsStateMachine();
|
turnState = gameState.getTurnState();
|
||||||
turnState = turnState.getTurnState();
|
|
||||||
|
|
||||||
|
|
||||||
//initialize the states
|
//initialize the states
|
||||||
@@ -700,7 +696,7 @@ public void testWaitToGameEndState() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTurnSubStatesToGameEndState() {
|
public void testTurnSubStatesToGameEndState() {
|
||||||
// Implementation goes here
|
// todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -708,7 +704,7 @@ public void testTurnSubStatesToGameEndState() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTurnSubStatesToWait() {
|
public void testTurnSubStatesToWait() {
|
||||||
// Implementation goes here
|
// todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -716,7 +712,7 @@ public void testTurnSubStatesToWait() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTurnSubStatesToSpectator() {
|
public void testTurnSubStatesToSpectator() {
|
||||||
// Implementation goes here
|
// todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -724,7 +720,7 @@ public void testTurnSubStatesToSpectator() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSpectatorToGameEndState() {
|
public void testSpectatorToGameEndState() {
|
||||||
// Implementation goes here
|
// todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1001,7 +997,7 @@ public void testChoosePieceToMovePiece() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMovePieceToWait() {
|
public void testMovePieceToWait() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1009,7 +1005,7 @@ public void testMovePieceToWait() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMovePieceToSpectator() {
|
public void testMovePieceToSpectator() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1017,7 +1013,7 @@ public void testMovePieceToSpectator() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMovePieceToCeremony() {
|
public void testMovePieceToCeremony() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1025,7 +1021,7 @@ public void testMovePieceToCeremony() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStayInChoosePowerCard() {
|
public void testStayInChoosePowerCard() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1508,7 +1504,7 @@ public void testStartPieceToChoosePieceEndState() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRollRankingDiceToWaitRanking() {
|
public void testRollRankingDiceToWaitRanking() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1516,7 +1512,7 @@ public void testRollRankingDiceToWaitRanking() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWaitRankingToRollRankingDice() {
|
public void testWaitRankingToRollRankingDice() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1524,7 +1520,7 @@ public void testWaitRankingToRollRankingDice() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWaitRankingToEndStateDetermineStartingPlayer() {
|
public void testWaitRankingToEndStateDetermineStartingPlayer() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1591,7 +1587,7 @@ public void testMainSettingsToAudioSettings() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMainSettingsToClientState() {
|
public void testMainSettingsToClientState() {
|
||||||
// Implementation goes here
|
// Todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1659,7 +1655,7 @@ public void testAudioSettingsToMainSettings() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testClientStateSubStatesToMainSettings() {
|
public void testClientStateSubStatesToMainSettings() {
|
||||||
// Implementation goes here
|
// todo Implementation goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class ServerStateTest {
|
|||||||
private SelectCard selectCard;
|
private SelectCard selectCard;
|
||||||
private SelectedPieces selectedPieces;
|
private SelectedPieces selectedPieces;
|
||||||
private SelectTSK selectTSK;
|
private SelectTSK selectTSK;
|
||||||
|
private Disconnected disconnect;
|
||||||
|
|
||||||
//declare state-machines here
|
//declare state-machines here
|
||||||
private CeremonyState ceremonyState;
|
private CeremonyState ceremonyState;
|
||||||
@@ -229,7 +230,10 @@ public void testServerGameSubStatesToInterrupt() {
|
|||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
||||||
|
|
||||||
//TODO create interrupt
|
//Todo
|
||||||
|
|
||||||
|
//sends the interrupt
|
||||||
|
serverGameLogic.received(disconnect,from);
|
||||||
|
|
||||||
//tests if the server is in the Interrupt-state
|
//tests if the server is in the Interrupt-state
|
||||||
assertEquals(serverGameLogic.getInterruptState(),interruptState);
|
assertEquals(serverGameLogic.getInterruptState(),interruptState);
|
||||||
@@ -242,12 +246,12 @@ public void testServerGameSubStatesToInterrupt() {
|
|||||||
public void testServerGameToCeremony() {
|
public void testServerGameToCeremony() {
|
||||||
//sends the server in the gameState
|
//sends the server in the gameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//Todo game is finished
|
//Todo game is finished
|
||||||
|
|
||||||
//tests if the server is in the Ceremony-state
|
//tests if the server is in the Ceremony-state
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof CeremonyState);
|
assertEquals(serverGameLogic.getCurrentState() ,ceremonyState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,13 +261,15 @@ public void testServerGameToCeremony() {
|
|||||||
public void testInterruptToGameContinue() {
|
public void testInterruptToGameContinue() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
serverGameLogic.setCurrentState(interruptState);
|
serverGameLogic.setCurrentState(interruptState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof InterruptState);
|
assertEquals(serverGameLogic.getCurrentState() ,interruptState);
|
||||||
|
|
||||||
|
//Todo send all other messages except forceContinue
|
||||||
|
|
||||||
//sends the continue-message to the server
|
//sends the continue-message to the server
|
||||||
serverGameLogic.received(forceContinueGame, from);
|
serverGameLogic.received(forceContinueGame, from);
|
||||||
|
|
||||||
//tests if new Stet is in GameState
|
//tests if new Stet is in GameState
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,12 +279,12 @@ public void testInterruptToGameContinue() {
|
|||||||
public void testInterruptToGameReconnect() {
|
public void testInterruptToGameReconnect() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
serverGameLogic.setCurrentState(interruptState);
|
serverGameLogic.setCurrentState(interruptState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof InterruptState);
|
assertEquals(serverGameLogic.getCurrentState() ,interruptState);
|
||||||
|
|
||||||
//todo implement the timer
|
//todo implement the timer
|
||||||
|
|
||||||
//tests if new Stet is in GameState
|
//tests if new Stet is in GameState
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,12 +294,12 @@ public void testInterruptToGameReconnect() {
|
|||||||
public void testInterruptToGameTimer() {
|
public void testInterruptToGameTimer() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
serverGameLogic.setCurrentState(interruptState);
|
serverGameLogic.setCurrentState(interruptState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof InterruptState);
|
assertEquals(serverGameLogic.getCurrentState() ,interruptState);
|
||||||
|
|
||||||
//Todo implement the timer
|
//Todo implement the timer
|
||||||
|
|
||||||
//tests if new Stet is in GameState
|
//tests if new Stet is in GameState
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,17 +318,17 @@ public void testCeremonyToServerStateEndState() {
|
|||||||
public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in DSP-state
|
//sends the gameState in DSP-state
|
||||||
gameState.setCurrentState(determineStartPlayerState);
|
gameState.setCurrentState(determineStartPlayerState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof DetermineStartPlayerState);
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
|
|
||||||
//TODO sends messages to the server
|
//TODO sends messages to the server
|
||||||
|
|
||||||
//tests if the server is still in DSP-state
|
//tests if the server is still in DSP-state
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof DetermineStartPlayerState);
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,17 +338,26 @@ public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
|||||||
public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in DSP-state
|
//sends the gameState in DSP-state
|
||||||
gameState.setCurrentState(determineStartPlayerState);
|
gameState.setCurrentState(determineStartPlayerState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof DetermineStartPlayerState);
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
|
|
||||||
//TODO sends messages 2 RequestDiceMessage, die gleich geränkt werden to the server
|
//TODO sends messages 2 RequestDiceMessage, die gleich geränkt werden to the server
|
||||||
|
//sends the requestDiceMessage to the server
|
||||||
|
gameState.received(requestDice, from);
|
||||||
|
|
||||||
//tests if the server is still in DSP-state
|
//tests if the server is still in DSP-state
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof DetermineStartPlayerState);
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
|
|
||||||
|
//sends the requestDiceMessage to the server
|
||||||
|
gameState.received(requestMove, fromHost);
|
||||||
|
|
||||||
|
//tests if the server is still in DSP-state
|
||||||
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -352,17 +367,17 @@ public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
|||||||
public void testDetermineStartPlayerToAnimation() {
|
public void testDetermineStartPlayerToAnimation() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in DSP-state
|
//sends the gameState in DSP-state
|
||||||
gameState.setCurrentState(determineStartPlayerState);
|
gameState.setCurrentState(determineStartPlayerState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof DetermineStartPlayerState);
|
assertEquals(gameState.getCurrentState() ,determineStartPlayerState);
|
||||||
|
|
||||||
//TODO sends messages 2 RequestDiceMessage, die ungleich geränkt werden, sodass der server weitergeht
|
//TODO sends messages 2 RequestDiceMessage, die ungleich geränkt werden, sodass der server weitergeht
|
||||||
|
|
||||||
//tests if the Server is in animationState
|
//tests if the Server is in animationState
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof Animation);
|
assertEquals(gameState.getCurrentState() ,animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -373,26 +388,24 @@ public void testDetermineStartPlayerToAnimation() {
|
|||||||
public void testAnimationToPowerCard() {
|
public void testAnimationToPowerCard() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Animation
|
//sends the gameState in Animation
|
||||||
gameState.setCurrentState(animation);
|
gameState.setCurrentState(animation);
|
||||||
assertTrue(gameState.getCurrentState() instanceof Animation);
|
assertEquals(gameState.getCurrentState() ,animation);
|
||||||
|
|
||||||
//receives one animation endMessage and tests if the server is still in the Animation-state
|
//receives one animation endMessage and tests if the server is still in the Animation-state
|
||||||
serverGameLogic.received(animationEnd, fromHost);
|
serverGameLogic.received(animationEnd, fromHost);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof Animation);
|
assertEquals(gameState.getCurrentState() ,animation);
|
||||||
|
|
||||||
//receives another animation endMessage
|
//receives another animation endMessage
|
||||||
serverGameLogic.received(animationEnd, from);
|
serverGameLogic.received(animationEnd, from);
|
||||||
|
|
||||||
//tests if the server is in the PowerCard-state
|
//tests if the server is in the PowerCard-state
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
TurnState turnState1 = (TurnState) gameState.getCurrentState();
|
assertEquals(turnState.getCurrentState() ,powerCardState);
|
||||||
TurnState turnState = (TurnState) turnState1.getTurnState();
|
|
||||||
assertTrue(turnState.getCurrentState() instanceof PowerCardState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -403,17 +416,17 @@ public void testAnimationToPowerCard() {
|
|||||||
public void testTurnToAnimation() {
|
public void testTurnToAnimation() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//todo set the turn finished and there are still two players left
|
//todo set the turn finished and there are still two players left
|
||||||
|
|
||||||
//tests if the server is in the AnimationState
|
//tests if the server is in the AnimationState
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof Animation);
|
assertEquals(gameState.getCurrentState() ,animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,16 +437,16 @@ public void testTurnToAnimation() {
|
|||||||
public void testTurnToGameEndState() {
|
public void testTurnToGameEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//todo set the turn finished and there is only one players left
|
//todo set the turn finished and there is only one players left
|
||||||
|
|
||||||
//tests if the server is in the end-state of game, Ceremony
|
//tests if the server is in the end-state of game, Ceremony
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof CeremonyState);
|
assertEquals(serverGameLogic.getCurrentState() ,ceremonyState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -444,22 +457,22 @@ public void testTurnToGameEndState() {
|
|||||||
public void testStayInPowerCard() {
|
public void testStayInPowerCard() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in PowerCard
|
//sends the TurnState in PowerCard
|
||||||
turnState.setCurrentState(powerCardState);
|
turnState.setCurrentState(powerCardState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PowerCardState);
|
assertEquals(turnState.getCurrentState() ,powerCardState);
|
||||||
|
|
||||||
//Todo: receive messages which dont lead to a state change
|
//Todo: receive messages which dont lead to a state change
|
||||||
|
|
||||||
//tests if the server is in PowerCard
|
//tests if the server is in PowerCard
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PowerCardState);
|
assertEquals(turnState.getCurrentState() ,powerCardState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -470,22 +483,22 @@ public void testStayInPowerCard() {
|
|||||||
public void testPowerCardToPlayPowerCard() {
|
public void testPowerCardToPlayPowerCard() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in PowerCard
|
//sends the TurnState in PowerCard
|
||||||
turnState.setCurrentState(powerCardState);
|
turnState.setCurrentState(powerCardState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PowerCardState);
|
assertEquals(turnState.getCurrentState() ,powerCardState);
|
||||||
|
|
||||||
//todo
|
//todo
|
||||||
|
|
||||||
//tests if the server is in PlayPowerCard
|
//tests if the server is in PlayPowerCard
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PlayPowerCard);
|
assertEquals(turnState.getCurrentState() ,playPowerCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -496,32 +509,30 @@ public void testPowerCardToPlayPowerCard() {
|
|||||||
public void testPlayPowerCardToRollDice() {
|
public void testPlayPowerCardToRollDice() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in PowerCard
|
//sends the TurnState in PowerCard
|
||||||
turnState.setCurrentState(playPowerCard);
|
turnState.setCurrentState(playPowerCard);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PlayPowerCard);
|
assertEquals(turnState.getCurrentState() ,playPowerCard);
|
||||||
|
|
||||||
//receive first AnimationEndMessage from the host
|
//receive first AnimationEndMessage from the host
|
||||||
serverGameLogic.received(animationEnd, fromHost);
|
serverGameLogic.received(animationEnd, fromHost);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof PlayPowerCard);
|
assertEquals(turnState.getCurrentState() ,playPowerCard);
|
||||||
|
|
||||||
//receive second AnimationEndMessage
|
//receive second AnimationEndMessage
|
||||||
serverGameLogic.received(animationEnd, from);
|
serverGameLogic.received(animationEnd, from);
|
||||||
|
|
||||||
//tests if the server is in RollDice and in FirstRoll
|
//tests if the server is in RollDice and in FirstRoll
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
RollDiceState rollDiceState = (RollDiceState) turnState.getCurrentState();
|
assertEquals(rollDiceState.getCurrentState() ,firstRollState);
|
||||||
RollDiceMachine rollDiceMachine1 = rollDiceState.getRollDiceStateMachine();
|
|
||||||
assertTrue(rollDiceMachine1.getCurrentState() instanceof FirstRollStateState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -532,21 +543,21 @@ public void testPlayPowerCardToRollDice() {
|
|||||||
public void testChoosePieceToMovePiece() {
|
public void testChoosePieceToMovePiece() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in ChoosePiece
|
//sends the TurnState in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//Todo ???
|
//Todo ???
|
||||||
|
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof MovePieceState);
|
assertEquals(turnState.getCurrentState() ,movePieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -557,15 +568,15 @@ public void testChoosePieceToMovePiece() {
|
|||||||
public void testMovePieceToTurnEndState() {
|
public void testMovePieceToTurnEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in MovePiece
|
//sends the TurnState in MovePiece
|
||||||
turnState.setCurrentState(movePieceState);
|
turnState.setCurrentState(movePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof MovePieceState);
|
assertEquals(turnState.getCurrentState() ,movePieceState);
|
||||||
|
|
||||||
//Todo no 6 was rolled, so the server looks, if there are 2 or less player are still in the game
|
//Todo no 6 was rolled, so the server looks, if there are 2 or less player are still in the game
|
||||||
//TODO
|
//TODO
|
||||||
@@ -580,24 +591,22 @@ public void testMovePieceToTurnEndState() {
|
|||||||
public void testMovePieceToFirstRoll() {
|
public void testMovePieceToFirstRoll() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in MovePiece
|
//sends the TurnState in MovePiece
|
||||||
turnState.setCurrentState(movePieceState);
|
turnState.setCurrentState(movePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof MovePieceState);
|
assertEquals(turnState.getCurrentState() ,movePieceState);
|
||||||
|
|
||||||
//Todo the player rolled a 6 and the player is not finished
|
//Todo the player rolled a 6 and the player is not finished
|
||||||
|
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
RollDiceState rollDiceState = (RollDiceState) turnState.getCurrentState();
|
assertEquals(rollDiceState.getCurrentState() ,firstRollStateState);
|
||||||
RollDiceMachine rollDiceMachine1 = rollDiceState.getRollDiceStateMachine();
|
|
||||||
assertTrue(rollDiceMachine1.getCurrentState() instanceof FirstRollStateState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -608,29 +617,27 @@ public void testMovePieceToFirstRoll() {
|
|||||||
public void testFirstRollToRollDiceEndState() {
|
public void testFirstRollToRollDiceEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in FirstRoll
|
//sends the RollDiceMachine in FirstRoll
|
||||||
rollDiceMachine.setCurrentState(firstRollState);
|
rollDiceMachine.setCurrentState(firstRollState);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof FirstRollStateState);
|
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState);
|
||||||
|
|
||||||
//TODO 2 Möglichkeiten
|
//TODO 2 Möglichkeiten
|
||||||
|
|
||||||
//tests if the server is in NoPiece of ChoosePiece
|
//tests if the server is in NoPiece of ChoosePiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
ChoosePieceState choosePieceState1 = (ChoosePieceState) turnState.getCurrentState();
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
ChoosePieceStateMachine choosePieceState = choosePieceState1.getChoosePieceStateMachine();
|
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -641,27 +648,27 @@ public void testFirstRollToRollDiceEndState() {
|
|||||||
public void testFirstRollToSecondRoll() {
|
public void testFirstRollToSecondRoll() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in FirstRoll
|
//sends the RollDiceMachine in FirstRoll
|
||||||
rollDiceMachine.setCurrentState(firstRollState);
|
rollDiceMachine.setCurrentState(firstRollState);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof FirstRollStateState);
|
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState);
|
||||||
|
|
||||||
//Todo player has no figures to move and had no 6
|
//Todo player has no figures to move and had no 6
|
||||||
|
|
||||||
//tests if the server is in the SecondRoll
|
//tests if the server is in the SecondRoll
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof SecondRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -672,29 +679,27 @@ public void testFirstRollToSecondRoll() {
|
|||||||
public void testSecondRollToRollDiceEndState() {
|
public void testSecondRollToRollDiceEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in SecondRoll
|
//sends the RollDiceMachine in SecondRoll
|
||||||
rollDiceMachine.setCurrentState(secondRoll);
|
rollDiceMachine.setCurrentState(secondRoll);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof SecondRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
|
|
||||||
//tests if the server is in NoPiece of ChoosePiece
|
//tests if the server is in NoPiece of ChoosePiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
ChoosePieceState choosePieceState1 = (ChoosePieceState) turnState.getCurrentState();
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
ChoosePieceStateMachine choosePieceState = choosePieceState1.getChoosePieceStateMachine();
|
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -705,27 +710,27 @@ public void testSecondRollToRollDiceEndState() {
|
|||||||
public void testSecondRollToThirdRoll() {
|
public void testSecondRollToThirdRoll() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in SecondRoll
|
//sends the RollDiceMachine in SecondRoll
|
||||||
rollDiceMachine.setCurrentState(secondRoll);
|
rollDiceMachine.setCurrentState(secondRoll);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof SecondRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
||||||
|
|
||||||
//Todo player has no figures to move and had no 6
|
//Todo player has no figures to move and had no 6
|
||||||
|
|
||||||
//tests if the server is in the ThirdRoll
|
//tests if the server is in the ThirdRoll
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof ThirdRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -736,29 +741,27 @@ public void testSecondRollToThirdRoll() {
|
|||||||
public void testThirdRollToRollDiceEndState() {
|
public void testThirdRollToRollDiceEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in ThirdRoll
|
//sends the RollDiceMachine in ThirdRoll
|
||||||
rollDiceMachine.setCurrentState(thirdRoll);
|
rollDiceMachine.setCurrentState(thirdRoll);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof ThirdRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
|
|
||||||
//tests if the server is in NoPiece of ChoosePiece
|
//tests if the server is in NoPiece of ChoosePiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
ChoosePieceState choosePieceState1 = (ChoosePieceState) turnState.getCurrentState();
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
ChoosePieceStateMachine choosePieceState = choosePieceState1.getChoosePieceStateMachine();
|
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -769,19 +772,19 @@ public void testThirdRollToRollDiceEndState() {
|
|||||||
public void testThirdRollToTurnEndState() {
|
public void testThirdRollToTurnEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the gameState in Turn
|
//sends the gameState in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the TurnState in RollDice
|
//sends the TurnState in RollDice
|
||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof RollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in ThirdRoll
|
//sends the RollDiceMachine in ThirdRoll
|
||||||
rollDiceMachine.setCurrentState(thirdRoll);
|
rollDiceMachine.setCurrentState(thirdRoll);
|
||||||
assertTrue(rollDiceMachine.getCurrentState() instanceof ThirdRollState);
|
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
}
|
}
|
||||||
@@ -794,27 +797,27 @@ public void testThirdRollToTurnEndState() {
|
|||||||
public void testNoPieceToWaitingPiece() {
|
public void testNoPieceToWaitingPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in NoPiece
|
//sends the server in NoPiece
|
||||||
choosePieceState.setCurrentState(noPiece);
|
choosePieceState.setCurrentState(noPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in WaitingPiece
|
//tests if the server is in WaitingPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof WaitingPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,waitingPieceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,27 +829,27 @@ public void testNoPieceToWaitingPiece() {
|
|||||||
public void testNoPieceToNoTurn() {
|
public void testNoPieceToNoTurn() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in NoPiece
|
//sends the server in NoPiece
|
||||||
choosePieceState.setCurrentState(noPiece);
|
choosePieceState.setCurrentState(noPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in NoTurn
|
//tests if the server is in NoTurn
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoTurnState);
|
assertEquals(choosePieceState.getCurrentState() ,noTurnState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -857,19 +860,19 @@ public void testNoPieceToNoTurn() {
|
|||||||
public void testNoTurnToTurnEndState() {
|
public void testNoTurnToTurnEndState() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in NoTurn
|
//sends the server in NoTurn
|
||||||
choosePieceState.setCurrentState(noTurnState);
|
choosePieceState.setCurrentState(noTurnState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoTurnState);
|
assertEquals(choosePieceState.getCurrentState() ,noTurnState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
@@ -882,27 +885,27 @@ public void testNoTurnToTurnEndState() {
|
|||||||
public void testStayInWaitingPiece() {
|
public void testStayInWaitingPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in WaitingPiece
|
//sends the server in WaitingPiece
|
||||||
choosePieceState.setCurrentState(waitingPiece);
|
choosePieceState.setCurrentState(waitingPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof WaitingPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,waitingPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in WaitingPiece
|
//tests if the server is in WaitingPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof WaitingPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,waitingPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -913,19 +916,19 @@ public void testStayInWaitingPiece() {
|
|||||||
public void testWaitingPieceToMovePiece() {
|
public void testWaitingPieceToMovePiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in WaitingPiece
|
//sends the server in WaitingPiece
|
||||||
choosePieceState.setCurrentState(waitingPiece);
|
choosePieceState.setCurrentState(waitingPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof WaitingPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,waitingPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
@@ -938,27 +941,27 @@ public void testWaitingPieceToMovePiece() {
|
|||||||
public void testNoPieceToSelectPiece() {
|
public void testNoPieceToSelectPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in NoPiece
|
//sends the server in NoPiece
|
||||||
choosePieceState.setCurrentState(noPiece);
|
choosePieceState.setCurrentState(noPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in SelectPiece
|
//tests if the server is in SelectPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof SelectPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,selectPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -969,27 +972,27 @@ public void testNoPieceToSelectPiece() {
|
|||||||
public void testNoPieceToStartPiece() {
|
public void testNoPieceToStartPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in NoPiece
|
//sends the server in NoPiece
|
||||||
choosePieceState.setCurrentState(noPiece);
|
choosePieceState.setCurrentState(noPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof NoPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,noPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in StartPiece
|
//tests if the server is in StartPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof StartPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,startPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1000,27 +1003,27 @@ public void testNoPieceToStartPiece() {
|
|||||||
public void testStayInSelectPiece() {
|
public void testStayInSelectPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in SelectPiece
|
//sends the server in SelectPiece
|
||||||
choosePieceState.setCurrentState(selectPiece);
|
choosePieceState.setCurrentState(selectPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof SelectPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,selectPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in SelectPiece
|
//tests if the server is in SelectPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof SelectPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,selectPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1031,21 +1034,26 @@ public void testStayInSelectPiece() {
|
|||||||
public void testSelectPieceToMovePiece() {
|
public void testSelectPieceToMovePiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in SelectPiece
|
//sends the server in SelectPiece
|
||||||
choosePieceState.setCurrentState(selectPiece);
|
choosePieceState.setCurrentState(selectPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof SelectPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,selectPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
|
//tests if the server is in movePiece-state
|
||||||
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
assertEquals(turnState.getCurrentState() ,movePieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1056,27 +1064,27 @@ public void testSelectPieceToMovePiece() {
|
|||||||
public void testStayInStartPiece() {
|
public void testStayInStartPiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in StartPiece
|
//sends the server in StartPiece
|
||||||
choosePieceState.setCurrentState(startPiece);
|
choosePieceState.setCurrentState(startPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof StartPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,startPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//tests if the server is in StartPiece
|
//tests if the server is in StartPiece
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof StartPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,startPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1087,20 +1095,25 @@ public void testStayInStartPiece() {
|
|||||||
public void testStartPieceToMovePiece() {
|
public void testStartPieceToMovePiece() {
|
||||||
//sends the server in GameState
|
//sends the server in GameState
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
assertTrue(serverGameLogic.getCurrentState() instanceof GameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
|
||||||
//sends the server in Turn
|
//sends the server in Turn
|
||||||
gameState.setCurrentState(turnState);
|
gameState.setCurrentState(turnState);
|
||||||
assertTrue(gameState.getCurrentState() instanceof TurnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
|
||||||
//sends the server in ChoosePiece
|
//sends the server in ChoosePiece
|
||||||
turnState.setCurrentState(choosePieceState);
|
turnState.setCurrentState(choosePieceState);
|
||||||
assertTrue(turnState.getCurrentState() instanceof ChoosePieceState);
|
assertEquals(turnState.getCurrentState() ,choosePieceState);
|
||||||
|
|
||||||
//sends the server in StartPiece
|
//sends the server in StartPiece
|
||||||
choosePieceState.setCurrentState(startPiece);
|
choosePieceState.setCurrentState(startPiece);
|
||||||
assertTrue(choosePieceState.getCurrentState() instanceof StartPieceState);
|
assertEquals(choosePieceState.getCurrentState() ,startPieceState);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
|
//tests if the server is in movePiece-state
|
||||||
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
|
assertEquals(turnState.getCurrentState() ,movePieceState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user