merge tests into development #25
@@ -15,6 +15,7 @@
|
|||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.message.client.ClientMessage;
|
import pp.mdga.message.client.ClientMessage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
@@ -282,7 +283,7 @@ public void testDialogsToClientStateEndState() {
|
|||||||
|
|
||||||
//sends dialogs in startDialog-state
|
//sends dialogs in startDialog-state
|
||||||
dialogs.setState(startDialog);
|
dialogs.setState(startDialog);
|
||||||
assertEquals(dialogs.getState(),startDialog);
|
assertEquals(dialogs.getState(), startDialog);
|
||||||
|
|
||||||
//TODO how?????????
|
//TODO how?????????
|
||||||
}
|
}
|
||||||
@@ -885,11 +886,11 @@ public void testTurnSubStatesToGameEndState() {
|
|||||||
|
|
||||||
//sends the gameState in turnState
|
//sends the gameState in turnState
|
||||||
gameState.setState(turnState);
|
gameState.setState(turnState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in movePiece
|
//sends the turnState in movePiece
|
||||||
turnState.setState(movePiece);
|
turnState.setState(movePiece);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//tests all messages, that don't indicate a state-change
|
//tests all messages, that don't indicate a state-change
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
@@ -926,15 +927,15 @@ public void testTurnSubStatesToGameEndState() {
|
|||||||
|
|
||||||
//tests if the client is still in MovePiece
|
//tests if the client is still in MovePiece
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//sends the spectator message
|
//sends the spectator message
|
||||||
clientGameLogic.received(ceremonyMessage);
|
clientGameLogic.received(ceremonyMessage);
|
||||||
|
|
||||||
//tests if the client is in spectator-state
|
//tests if the client is in spectator-state
|
||||||
assertEquals(clientGameLogic.getState(), ceremony);
|
assertEquals(clientGameLogic.getState(), ceremony);
|
||||||
assertEquals(ceremony.getState(),podium);
|
assertEquals(ceremony.getState(), podium);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -951,11 +952,11 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//sends the gameState in turnState
|
//sends the gameState in turnState
|
||||||
gameState.setState(turnState);
|
gameState.setState(turnState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in movePiece
|
//sends the turnState in movePiece
|
||||||
turnState.setState(movePiece);
|
turnState.setState(movePiece);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//tests all messages, that don't indicate a state-change
|
//tests all messages, that don't indicate a state-change
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
@@ -992,15 +993,15 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//tests if the client is still in MovePiece
|
//tests if the client is still in MovePiece
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//sends the endOfTurn message
|
//sends the endOfTurn message
|
||||||
clientGameLogic.received(endOfTurn);
|
clientGameLogic.received(endOfTurn);
|
||||||
|
|
||||||
//tests if the client is in waiting-state
|
//tests if the client is in waiting-state
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),waiting);
|
assertEquals(gameState.getState(), waiting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tests thr transition from choosePiece to Wait
|
* tests thr transition from choosePiece to Wait
|
||||||
@@ -1012,15 +1013,15 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//sends the gameState in turnState
|
//sends the gameState in turnState
|
||||||
gameState.setState(turnState);
|
gameState.setState(turnState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in choosePiece
|
//sends the turnState in choosePiece
|
||||||
turnState.setState(movePiece);
|
turnState.setState(movePiece);
|
||||||
assertEquals(turnState.getState(),choosePiece);
|
assertEquals(turnState.getState(), choosePiece);
|
||||||
|
|
||||||
//sends the choosePiece in NoPiece
|
//sends the choosePiece in NoPiece
|
||||||
choosePiece.setState(noPiece);
|
choosePiece.setState(noPiece);
|
||||||
assertEquals(choosePiece.getState(),noPiece);
|
assertEquals(choosePiece.getState(), noPiece);
|
||||||
|
|
||||||
//tests all messages, that don't indicate a state-change
|
//tests all messages, that don't indicate a state-change
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
@@ -1057,16 +1058,16 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//tests if the client is still in MovePiece
|
//tests if the client is still in MovePiece
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),choosePiece);
|
assertEquals(turnState.getState(), choosePiece);
|
||||||
assertEquals(choosePiece.getState(),noPiece);
|
assertEquals(choosePiece.getState(), noPiece);
|
||||||
|
|
||||||
//sends the endOfTurn message
|
//sends the endOfTurn message
|
||||||
clientGameLogic.received(endOfTurn);
|
clientGameLogic.received(endOfTurn);
|
||||||
|
|
||||||
//tests if the client is in waiting-state
|
//tests if the client is in waiting-state
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),waiting);
|
assertEquals(gameState.getState(), waiting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tests the transition from RollDice to Wait
|
* tests the transition from RollDice to Wait
|
||||||
@@ -1078,11 +1079,11 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//sends the gameState in turnState
|
//sends the gameState in turnState
|
||||||
gameState.setState(turnState);
|
gameState.setState(turnState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in movePiece
|
//sends the turnState in movePiece
|
||||||
turnState.setState(movePiece);
|
turnState.setState(movePiece);
|
||||||
assertEquals(turnState.getState(),rollDice);
|
assertEquals(turnState.getState(), rollDice);
|
||||||
|
|
||||||
//tests all messages, that don't indicate a state-change
|
//tests all messages, that don't indicate a state-change
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
@@ -1119,15 +1120,15 @@ public void testTurnSubStatesToWait() {
|
|||||||
|
|
||||||
//tests if the client is still in MovePiece
|
//tests if the client is still in MovePiece
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),rollDice);
|
assertEquals(turnState.getState(), rollDice);
|
||||||
|
|
||||||
//sends the endOfTurn message
|
//sends the endOfTurn message
|
||||||
clientGameLogic.received(endOfTurn);
|
clientGameLogic.received(endOfTurn);
|
||||||
|
|
||||||
//tests if the client is in waiting-state
|
//tests if the client is in waiting-state
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),waiting);
|
assertEquals(gameState.getState(), waiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1141,11 +1142,11 @@ public void testTurnSubStatesToSpectator() {
|
|||||||
|
|
||||||
//sends the gameState in turnState
|
//sends the gameState in turnState
|
||||||
gameState.setState(turnState);
|
gameState.setState(turnState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in movePiece
|
//sends the turnState in movePiece
|
||||||
turnState.setState(movePiece);
|
turnState.setState(movePiece);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//tests all messages, that don't indicate a state-change
|
//tests all messages, that don't indicate a state-change
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
@@ -1182,15 +1183,15 @@ public void testTurnSubStatesToSpectator() {
|
|||||||
|
|
||||||
//tests if the client is still in MovePiece
|
//tests if the client is still in MovePiece
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),movePiece);
|
assertEquals(turnState.getState(), movePiece);
|
||||||
|
|
||||||
//sends the spectator message
|
//sends the spectator message
|
||||||
clientGameLogic.received(spectatorMessage);
|
clientGameLogic.received(spectatorMessage);
|
||||||
|
|
||||||
//tests if the client is in spectator-state
|
//tests if the client is in spectator-state
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),spectator);
|
assertEquals(gameState.getState(), spectator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1248,7 +1249,7 @@ public void testSpectatorToGameEndState() {
|
|||||||
|
|
||||||
//tests if the client is in the podium-state
|
//tests if the client is in the podium-state
|
||||||
assertEquals(clientGameLogic.getState(), ceremony);
|
assertEquals(clientGameLogic.getState(), ceremony);
|
||||||
assertEquals(ceremony.getState(),podium);
|
assertEquals(ceremony.getState(), podium);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1313,7 +1314,7 @@ public void testPowerCardSubStatesToPlayPowerCard() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* UC-ClientState-30: Test the transition from PowerCard sub-states to RollDice.
|
* UC-ClientState-30: Test the transition from PowerCard sub-states to RollDice.
|
||||||
*
|
* <p>
|
||||||
* tests the transition from ChoosePowerCard from PowerCard to RollDice
|
* tests the transition from ChoosePowerCard from PowerCard to RollDice
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@@ -1572,7 +1573,7 @@ public void testRollDiceToWait() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* UC-ClientState-36: Test the transition from ChoosePiece to Wait.
|
* UC-ClientState-36: Test the transition from ChoosePiece to Wait.
|
||||||
*
|
* <p>
|
||||||
* this method tests the transition from noPiece to Wait
|
* this method tests the transition from noPiece to Wait
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@@ -1591,7 +1592,7 @@ public void testChoosePieceToWait() {
|
|||||||
|
|
||||||
//sends the choosePiece into noTurn
|
//sends the choosePiece into noTurn
|
||||||
choosePiece.setState(noPiece);
|
choosePiece.setState(noPiece);
|
||||||
assertEquals(choosePiece.getState(),noPiece);
|
assertEquals(choosePiece.getState(), noPiece);
|
||||||
|
|
||||||
//send the noTurnMessage
|
//send the noTurnMessage
|
||||||
clientGameLogic.received(noTurn);
|
clientGameLogic.received(noTurn);
|
||||||
@@ -1625,7 +1626,7 @@ public void testChoosePieceToMovePiece() {
|
|||||||
|
|
||||||
//sends the choosePiece into waitingPiece
|
//sends the choosePiece into waitingPiece
|
||||||
choosePiece.setState(waitingPiece);
|
choosePiece.setState(waitingPiece);
|
||||||
assertEquals(choosePiece.getState(),waitingPiece);
|
assertEquals(choosePiece.getState(), waitingPiece);
|
||||||
|
|
||||||
//sends the movePieceMessage
|
//sends the movePieceMessage
|
||||||
clientGameLogic.received(moveMessage);
|
clientGameLogic.received(moveMessage);
|
||||||
@@ -1652,7 +1653,7 @@ public void testChoosePieceToMovePiece() {
|
|||||||
|
|
||||||
//sends the choosePiece into startPiece
|
//sends the choosePiece into startPiece
|
||||||
choosePiece.setState(startPiece);
|
choosePiece.setState(startPiece);
|
||||||
assertEquals(choosePiece.getState(),startPiece);
|
assertEquals(choosePiece.getState(), startPiece);
|
||||||
|
|
||||||
//sends the movePieceMessage
|
//sends the movePieceMessage
|
||||||
clientGameLogic.received(moveMessage);
|
clientGameLogic.received(moveMessage);
|
||||||
@@ -1679,7 +1680,7 @@ public void testChoosePieceToMovePiece() {
|
|||||||
|
|
||||||
//sends the choosePiece into selectPiece
|
//sends the choosePiece into selectPiece
|
||||||
choosePiece.setState(selectPiece);
|
choosePiece.setState(selectPiece);
|
||||||
assertEquals(choosePiece.getState(),selectPiece);
|
assertEquals(choosePiece.getState(), selectPiece);
|
||||||
|
|
||||||
//sends the movePieceMessage
|
//sends the movePieceMessage
|
||||||
clientGameLogic.received(moveMessage);
|
clientGameLogic.received(moveMessage);
|
||||||
@@ -1738,7 +1739,7 @@ public void testMovePieceToSpectator() {
|
|||||||
|
|
||||||
//tests if the client is in Spectator
|
//tests if the client is in Spectator
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),spectator);
|
assertEquals(gameState.getState(), spectator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1763,7 +1764,7 @@ public void testMovePieceToCeremony() {
|
|||||||
|
|
||||||
//tests if the client is in Spectator
|
//tests if the client is in Spectator
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),spectator);
|
assertEquals(gameState.getState(), spectator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1815,12 +1816,11 @@ public void testStayInChoosePowerCard() {
|
|||||||
clientGameLogic.received(waitPiece);
|
clientGameLogic.received(waitPiece);
|
||||||
clientGameLogic.received(spectatorMessage);
|
clientGameLogic.received(spectatorMessage);
|
||||||
clientGameLogic.received(selectPieceMessage);
|
clientGameLogic.received(selectPieceMessage);
|
||||||
//TODO selectable pieces
|
|
||||||
|
|
||||||
//tests if the client is still in the choosePowerCard-State
|
//tests if the client is still in the choosePowerCard-State
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getState(),turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
assertEquals(turnState.getState(),choosePowerCard);
|
assertEquals(turnState.getState(), choosePowerCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2066,7 +2066,8 @@ public void testSwapToPowerCardEndState() {
|
|||||||
powerCard.setState(swap);
|
powerCard.setState(swap);
|
||||||
assertEquals(powerCard.getState(), swap);
|
assertEquals(powerCard.getState(), swap);
|
||||||
|
|
||||||
//todo send the message to force the statechange
|
//sends the playCardMessage
|
||||||
|
clientGameLogic.received(playCardSwap);
|
||||||
|
|
||||||
//tests if the client is in PlayPowerCard
|
//tests if the client is in PlayPowerCard
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
@@ -2558,16 +2559,16 @@ public void testRollRankingDiceToWaitRanking() {
|
|||||||
|
|
||||||
//test if the client is still in rollRankingDice
|
//test if the client is still in rollRankingDice
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),determineStartPlayer);
|
assertEquals(gameState.getLogic(), determineStartPlayer);
|
||||||
assertEquals(determineStartPlayer.getState(),rollRankingDice);
|
assertEquals(determineStartPlayer.getState(), rollRankingDice);
|
||||||
|
|
||||||
//sends die-message
|
//sends die-message
|
||||||
clientGameLogic.received(die);
|
clientGameLogic.received(die);
|
||||||
|
|
||||||
//test if the client is in waitRanking
|
//test if the client is in waitRanking
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),determineStartPlayer);
|
assertEquals(gameState.getLogic(), determineStartPlayer);
|
||||||
assertEquals(determineStartPlayer.getState(),waitRanking);
|
assertEquals(determineStartPlayer.getState(), waitRanking);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2622,16 +2623,16 @@ public void testWaitRankingToRollRankingDice() {
|
|||||||
|
|
||||||
//test if the client is still in waitRanking
|
//test if the client is still in waitRanking
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),determineStartPlayer);
|
assertEquals(gameState.getLogic(), determineStartPlayer);
|
||||||
assertEquals(determineStartPlayer.getState(),waitRanking);
|
assertEquals(determineStartPlayer.getState(), waitRanking);
|
||||||
|
|
||||||
//sends rankingRollAgain-message
|
//sends rankingRollAgain-message
|
||||||
clientGameLogic.received(rankingRollAgain);
|
clientGameLogic.received(rankingRollAgain);
|
||||||
|
|
||||||
//test if the client is in rollRankingDice
|
//test if the client is in rollRankingDice
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),determineStartPlayer);
|
assertEquals(gameState.getLogic(), determineStartPlayer);
|
||||||
assertEquals(determineStartPlayer.getState(),rollRankingDice);
|
assertEquals(determineStartPlayer.getState(), rollRankingDice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2686,15 +2687,15 @@ public void testWaitRankingToEndStateDetermineStartingPlayer() {
|
|||||||
|
|
||||||
//test if the client is still in waitRanking
|
//test if the client is still in waitRanking
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),determineStartPlayer);
|
assertEquals(gameState.getLogic(), determineStartPlayer);
|
||||||
assertEquals(determineStartPlayer.getState(),waitRanking);
|
assertEquals(determineStartPlayer.getState(), waitRanking);
|
||||||
|
|
||||||
//sends endOfTurn-message
|
//sends endOfTurn-message
|
||||||
clientGameLogic.received(endOfTurn);
|
clientGameLogic.received(endOfTurn);
|
||||||
|
|
||||||
//test if the client is in wait
|
//test if the client is in wait
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
assertEquals(gameState.getLogic(),waiting);
|
assertEquals(gameState.getLogic(), waiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2728,13 +2729,13 @@ public void testStatisticsToCeremonyEndState() {
|
|||||||
|
|
||||||
//sends the ceremony in statistics
|
//sends the ceremony in statistics
|
||||||
ceremony.setState(statistics);
|
ceremony.setState(statistics);
|
||||||
assertEquals(ceremony.getState(),statistics);
|
assertEquals(ceremony.getState(), statistics);
|
||||||
|
|
||||||
//TODO simulate button-push
|
//TODO simulate button-push
|
||||||
|
|
||||||
//tests if client is in startDialog
|
//tests if client is in startDialog
|
||||||
assertEquals(clientGameLogic.getState(), dialogs);
|
assertEquals(clientGameLogic.getState(), dialogs);
|
||||||
assertEquals(dialogs.getState(),startDialog);
|
assertEquals(dialogs.getState(), startDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ public class ServerStateTest {
|
|||||||
private SelectTSKMessage selectTSK;
|
private SelectTSKMessage selectTSK;
|
||||||
private DisconnectedMessage disconnect;
|
private DisconnectedMessage disconnect;
|
||||||
|
|
||||||
//declare state-machines here
|
//declare state-States here
|
||||||
|
|
||||||
//TODO: interrupt and lobby are no state-machines
|
//TODO: interrupt and lobby are no state-States
|
||||||
|
|
||||||
//declare states here
|
//declare states here
|
||||||
//TODO
|
//TODO
|
||||||
@@ -79,13 +79,13 @@ public class ServerStateTest {
|
|||||||
private RollDiceState rollDiceState;
|
private RollDiceState rollDiceState;
|
||||||
private SecondRollState secondRoll;
|
private SecondRollState secondRoll;
|
||||||
private SelectPieceState selectPiece;
|
private SelectPieceState selectPiece;
|
||||||
private StartPieceState startPiece;
|
private StartPieceState startPieceState;
|
||||||
private ThirdRollState thirdRoll;
|
private ThirdRollState thirdRoll;
|
||||||
private TurnState turnState;
|
private TurnState turnState;
|
||||||
private WaitingPieceState waitingPiece;
|
private WaitingPieceState waitingPiece;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO initialize the states and machines and messages here
|
* this method is used to initialize the attributes of this test-class
|
||||||
*/
|
*/
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -124,7 +124,7 @@ public void broadcast(ServerMessage message) {
|
|||||||
from = 1234;
|
from = 1234;
|
||||||
fromHost = 2345;
|
fromHost = 2345;
|
||||||
|
|
||||||
//initialize the state-machines here
|
//initialize the states here
|
||||||
thirdRoll = rollDiceState.getThirdRollState();
|
thirdRoll = rollDiceState.getThirdRollState();
|
||||||
secondRoll = rollDiceState.getSecondRollState();
|
secondRoll = rollDiceState.getSecondRollState();
|
||||||
firstRollState = rollDiceState.getThirdRollState();
|
firstRollState = rollDiceState.getThirdRollState();
|
||||||
@@ -132,7 +132,7 @@ public void broadcast(ServerMessage message) {
|
|||||||
noPiece = choosePieceState.getNoPieceState();
|
noPiece = choosePieceState.getNoPieceState();
|
||||||
noTurnState = choosePieceState.getNoTurnState();
|
noTurnState = choosePieceState.getNoTurnState();
|
||||||
waitingPiece = choosePieceState.getWaitingPieceState();
|
waitingPiece = choosePieceState.getWaitingPieceState();
|
||||||
startPiece = choosePieceState.getStartPieceState();
|
startPieceState = choosePieceState.getStartPieceState();
|
||||||
selectPiece =choosePieceState.getSelectPieceState();
|
selectPiece =choosePieceState.getSelectPieceState();
|
||||||
|
|
||||||
powerCardState = turnState.getPowerCardState();
|
powerCardState = turnState.getPowerCardState();
|
||||||
@@ -257,6 +257,9 @@ public void testInterruptToGameContinue() {
|
|||||||
|
|
||||||
//Todo send all other messages except forceContinue
|
//Todo send all other messages except forceContinue
|
||||||
|
|
||||||
|
//tests if the server is still in Interrupt
|
||||||
|
assertEquals(serverGameLogic.getCurrentState(),interruptState);
|
||||||
|
|
||||||
//sends the continue-message to the server
|
//sends the continue-message to the server
|
||||||
serverGameLogic.received(forceContinueGame, from);
|
serverGameLogic.received(forceContinueGame, from);
|
||||||
|
|
||||||
@@ -273,7 +276,7 @@ public void testInterruptToGameReconnect() {
|
|||||||
serverGameLogic.setCurrentState(interruptState);
|
serverGameLogic.setCurrentState(interruptState);
|
||||||
assertEquals(serverGameLogic.getCurrentState() ,interruptState);
|
assertEquals(serverGameLogic.getCurrentState() ,interruptState);
|
||||||
|
|
||||||
//todo implement the timer
|
//todo implement the reconnect
|
||||||
|
|
||||||
//tests if new Stet is in GameState
|
//tests if new Stet is in GameState
|
||||||
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
@@ -598,7 +601,7 @@ public void testMovePieceToFirstRoll() {
|
|||||||
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertEquals(gameState.getCurrentState() ,turnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
assertEquals(rollDiceState.getCurrentState() ,firstRollStateState);
|
assertEquals(rollDiceState.getCurrentState() ,firstRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -619,9 +622,9 @@ public void testFirstRollToRollDiceEndState() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in FirstRoll
|
//sends the RollDiceState in FirstRoll
|
||||||
rollDiceMachine.setCurrentState(firstRollState);
|
rollDiceState.setCurrentState(firstRollState);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState);
|
assertEquals(rollDiceState.getCurrentState() ,firstRollState);
|
||||||
|
|
||||||
//TODO 2 Möglichkeiten
|
//TODO 2 Möglichkeiten
|
||||||
|
|
||||||
@@ -650,9 +653,9 @@ public void testFirstRollToSecondRoll() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in FirstRoll
|
//sends the RollDiceState in FirstRoll
|
||||||
rollDiceMachine.setCurrentState(firstRollState);
|
rollDiceState.setCurrentState(firstRollState);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,firstRollStateState);
|
assertEquals(rollDiceState.getCurrentState() ,firstRollState);
|
||||||
|
|
||||||
//Todo player has no figures to move and had no 6
|
//Todo player has no figures to move and had no 6
|
||||||
|
|
||||||
@@ -660,7 +663,7 @@ public void testFirstRollToSecondRoll() {
|
|||||||
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertEquals(gameState.getCurrentState() ,turnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
assertEquals(rollDiceState.getCurrentState() ,secondRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -681,9 +684,9 @@ public void testSecondRollToRollDiceEndState() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in SecondRoll
|
//sends the RollDiceState in SecondRoll
|
||||||
rollDiceMachine.setCurrentState(secondRoll);
|
rollDiceState.setCurrentState(secondRoll);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
assertEquals(rollDiceState.getCurrentState() ,secondRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
|
|
||||||
@@ -712,9 +715,9 @@ public void testSecondRollToThirdRoll() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in SecondRoll
|
//sends the RollDiceState in SecondRoll
|
||||||
rollDiceMachine.setCurrentState(secondRoll);
|
rollDiceState.setCurrentState(secondRoll);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,secondRollState);
|
assertEquals(rollDiceState.getCurrentState() ,secondRollState);
|
||||||
|
|
||||||
//Todo player has no figures to move and had no 6
|
//Todo player has no figures to move and had no 6
|
||||||
|
|
||||||
@@ -722,7 +725,7 @@ public void testSecondRollToThirdRoll() {
|
|||||||
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
assertEquals(serverGameLogic.getCurrentState() ,gameState);
|
||||||
assertEquals(gameState.getCurrentState() ,turnState);
|
assertEquals(gameState.getCurrentState() ,turnState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -743,9 +746,9 @@ public void testThirdRollToRollDiceEndState() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in ThirdRoll
|
//sends the RollDiceState in ThirdRoll
|
||||||
rollDiceMachine.setCurrentState(thirdRoll);
|
rollDiceState.setCurrentState(thirdRoll);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
|
|
||||||
@@ -774,9 +777,9 @@ public void testThirdRollToTurnEndState() {
|
|||||||
turnState.setCurrentState(rollDiceState);
|
turnState.setCurrentState(rollDiceState);
|
||||||
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
assertEquals(turnState.getCurrentState() ,rollDiceState);
|
||||||
|
|
||||||
//sends the RollDiceMachine in ThirdRoll
|
//sends the RollDiceState in ThirdRoll
|
||||||
rollDiceMachine.setCurrentState(thirdRoll);
|
rollDiceState.setCurrentState(thirdRoll);
|
||||||
assertEquals(rollDiceMachine.getCurrentState() ,thirdRollState);
|
assertEquals(rollDiceState.getCurrentState() ,thirdRollState);
|
||||||
|
|
||||||
//Todo
|
//Todo
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user