added some more tests andd edited some mor
This commit is contained in:
@@ -93,6 +93,7 @@ public class ClientStateTest {
|
||||
private UpdateTSKMessage updateTSK;
|
||||
private WaitPieceMessage waitPiece;
|
||||
private SpectatorMessage spectatorMessage;
|
||||
private SelectPieceMessage selectPieceMessage;
|
||||
|
||||
private int from;
|
||||
private String name;
|
||||
@@ -154,6 +155,7 @@ public void send(ClientMessage msg) {
|
||||
waitPiece = new WaitPieceMessage();
|
||||
interruptMessage = new PauseGameMessage();
|
||||
spectatorMessage = new SpectatorMessage();
|
||||
selectPieceMessage = new SelectPieceMessage();
|
||||
|
||||
//initialize the settings
|
||||
mainSettings = settings.getMainSettings();
|
||||
@@ -244,12 +246,13 @@ public void testDialogsToGame() {
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
//clientGameLogic.received(startGame); Todo rightful message
|
||||
//clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in lobby
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
@@ -273,7 +276,14 @@ public void testDialogsToGame() {
|
||||
*/
|
||||
@Test
|
||||
public void testDialogsToClientStateEndState() {
|
||||
//Todo Implementation goes here
|
||||
//sends the client in dialogs
|
||||
clientGameLogic.setState(dialogs);
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
|
||||
//sends dialogs in startDialog-state
|
||||
dialogs.setState(startDialog);
|
||||
assertEquals(dialogs.getState(),startDialog);
|
||||
|
||||
//TODO how?????????
|
||||
}
|
||||
|
||||
@@ -289,7 +299,7 @@ public void testClientGameToCeremony() {
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
//clientGameLogic.received(ceremonyMessage); todo rightful message
|
||||
//clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
@@ -316,6 +326,7 @@ public void testClientGameToCeremony() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in game-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -395,13 +406,14 @@ public void testStayInInterrupt() {
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
//clientGameLogic.received(resumeGame); Todo rightful message
|
||||
//clientGameLogic.received(resumeGame); commented out, because it indicates a state-change to gameState
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is in the interrupt
|
||||
assertEquals(clientGameLogic.getState(), interrupt);
|
||||
@@ -433,7 +445,9 @@ public void testInterruptToDialogs() {
|
||||
assertEquals(clientGameLogic.getState(), interrupt);
|
||||
|
||||
//Todo send the server-closed
|
||||
clientGameLogic.received();
|
||||
|
||||
//tests if the client is in the startDialog
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
assertEquals(dialogs.getState(), startDialog);
|
||||
}
|
||||
@@ -573,7 +587,7 @@ public void testNetworkDialogToNetworkDialog1() {
|
||||
clientGameLogic.selectReady(true);
|
||||
clientGameLogic.selectHost(name);
|
||||
//clientGameLogic.selectLeave(); commented because it indicate a state-change to start-dialog
|
||||
//clientGameLogic.selectJoin(name); commented because it indicate a state-change to lobby TODO
|
||||
//clientGameLogic.selectJoin(name); commented because it indicate a state-change to lobby
|
||||
clientGameLogic.selectAnimationEnd();
|
||||
clientGameLogic.selectStart();
|
||||
|
||||
@@ -703,6 +717,7 @@ public void testStayInLobby() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
assertEquals(dialogs.getState(), lobby);
|
||||
@@ -907,6 +922,7 @@ public void testTurnSubStatesToGameEndState() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
//clientGameLogic.received(spectatorMessage); commented because it indicate a state-change to spectator-state
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in MovePiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -926,7 +942,192 @@ public void testTurnSubStatesToGameEndState() {
|
||||
*/
|
||||
@Test
|
||||
public void testTurnSubStatesToWait() {
|
||||
// todo Implementation goes here
|
||||
/**
|
||||
* tests the transition from MovePiece to Wait
|
||||
*/
|
||||
//sends the clientGameLogic in gameState
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
//sends the gameState in turnState
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
|
||||
//sends the turnState in movePiece
|
||||
turnState.setState(movePiece);
|
||||
assertEquals(turnState.getState(),movePiece);
|
||||
|
||||
//tests all messages, that don't indicate a state-change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
//clientGameLogic.received(ceremonyMessage); commented because it indicate a state-change to ceremony-state
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
//clientGameLogic.received(diceNow); commented because it indicate a state-change to rollDice-state
|
||||
//clientGameLogic.received(endOfTurn); commented because it indicate a state-change to wait-state
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage); commented because it indicate a state-change to interrupt-state
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
//clientGameLogic.received(spectatorMessage); commented because it indicate a state-change to spectator-state
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in MovePiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
assertEquals(turnState.getState(),movePiece);
|
||||
|
||||
//sends the endOfTurn message
|
||||
clientGameLogic.received(endOfTurn);
|
||||
|
||||
//tests if the client is in waiting-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),waiting);
|
||||
|
||||
/**
|
||||
* tests thr transition from choosePiece to Wait
|
||||
*/
|
||||
|
||||
//sends the clientGameLogic in gameState
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
//sends the gameState in turnState
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
|
||||
//sends the turnState in choosePiece
|
||||
turnState.setState(movePiece);
|
||||
assertEquals(turnState.getState(),choosePiece);
|
||||
|
||||
//sends the choosePiece in NoPiece
|
||||
choosePiece.setState(noPiece);
|
||||
assertEquals(choosePiece.getState(),noPiece);
|
||||
|
||||
//tests all messages, that don't indicate a state-change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
//clientGameLogic.received(endOfTurn); commented because it indicate a state-change to wait-state
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage); commented because it indicate a state-change to interrupt-state
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
//clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
//clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
//clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in MovePiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
assertEquals(turnState.getState(),choosePiece);
|
||||
assertEquals(choosePiece.getState(),noPiece);
|
||||
|
||||
//sends the endOfTurn message
|
||||
clientGameLogic.received(endOfTurn);
|
||||
|
||||
//tests if the client is in waiting-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),waiting);
|
||||
|
||||
/**
|
||||
* tests the transition from RollDice to Wait
|
||||
*/
|
||||
|
||||
//sends the clientGameLogic in gameState
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
//sends the gameState in turnState
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
|
||||
//sends the turnState in movePiece
|
||||
turnState.setState(movePiece);
|
||||
assertEquals(turnState.getState(),rollDice);
|
||||
|
||||
//tests all messages, that don't indicate a state-change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
//clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
//clientGameLogic.received(endOfTurn); commented because it indicate a state-change to wait-state
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage); commented because it indicate a state-change to interrupt-state
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in MovePiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
assertEquals(turnState.getState(),rollDice);
|
||||
|
||||
//sends the endOfTurn message
|
||||
clientGameLogic.received(endOfTurn);
|
||||
|
||||
//tests if the client is in waiting-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),waiting);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -977,6 +1178,7 @@ public void testTurnSubStatesToSpectator() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
//clientGameLogic.received(spectatorMessage); commented because it indicate a state-change to spectator-state
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in MovePiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1035,6 +1237,7 @@ public void testSpectatorToGameEndState() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in spectator
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1162,7 +1365,7 @@ public void testStayInPlayPowerCard() {
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die); todo rightful message
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
//clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
@@ -1188,6 +1391,7 @@ public void testStayInPlayPowerCard() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1219,7 +1423,7 @@ public void testPlayPowerCardToRollDice() {
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
//clientGameLogic.received(diceNow); todo rightful message
|
||||
//clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
@@ -1243,6 +1447,7 @@ public void testPlayPowerCardToRollDice() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is in RollDice
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1306,6 +1511,7 @@ public void testStayInRollDice() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is in RollDice
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1383,7 +1589,12 @@ public void testChoosePieceToWait() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//TODO
|
||||
//sends the choosePiece into noTurn
|
||||
choosePiece.setState(noPiece);
|
||||
assertEquals(choosePiece.getState(),noPiece);
|
||||
|
||||
//send the noTurnMessage
|
||||
clientGameLogic.received(noTurn);
|
||||
|
||||
//tests if the client is in the wait-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1397,6 +1608,9 @@ public void testChoosePieceToWait() {
|
||||
*/
|
||||
@Test
|
||||
public void testChoosePieceToMovePiece() {
|
||||
/**
|
||||
* tests the transition from waitingPiece to MovePiece
|
||||
*/
|
||||
//sends the client into noPiece
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1409,7 +1623,9 @@ public void testChoosePieceToMovePiece() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//Todo
|
||||
//sends the choosePiece into waitingPiece
|
||||
choosePiece.setState(waitingPiece);
|
||||
assertEquals(choosePiece.getState(),waitingPiece);
|
||||
|
||||
//sends the movePieceMessage
|
||||
clientGameLogic.received(moveMessage);
|
||||
@@ -1418,6 +1634,60 @@ public void testChoosePieceToMovePiece() {
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
assertEquals(turnState.getState(), movePiece);
|
||||
|
||||
/**
|
||||
* tests the transition from startPiece to MovePiece
|
||||
*/
|
||||
//sends the client into noPiece
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
//sends the gameState into Turn
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnState into choosePiece
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//sends the choosePiece into startPiece
|
||||
choosePiece.setState(startPiece);
|
||||
assertEquals(choosePiece.getState(),startPiece);
|
||||
|
||||
//sends the movePieceMessage
|
||||
clientGameLogic.received(moveMessage);
|
||||
|
||||
//tests if the client is in the movePiece-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
assertEquals(turnState.getState(), movePiece);
|
||||
|
||||
/**
|
||||
* tests the transition from selectPiece to MovePiece
|
||||
*/
|
||||
//sends the client into noPiece
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
//sends the gameState into Turn
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnState into choosePiece
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//sends the choosePiece into selectPiece
|
||||
choosePiece.setState(selectPiece);
|
||||
assertEquals(choosePiece.getState(),selectPiece);
|
||||
|
||||
//sends the movePieceMessage
|
||||
clientGameLogic.received(moveMessage);
|
||||
|
||||
//tests if the client is in the movePiece-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
assertEquals(turnState.getState(), sele);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1437,10 +1707,8 @@ public void testMovePieceToWait() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), movePiece);
|
||||
|
||||
// Todo Implementation goes here
|
||||
|
||||
//sends the noTurnMessage
|
||||
clientGameLogic.received(noTurn);
|
||||
//sends the endOfTurnMessage
|
||||
clientGameLogic.received(endOfTurn);
|
||||
|
||||
//tests if the client is in the movePiece-state
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1465,8 +1733,6 @@ public void testMovePieceToSpectator() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), movePiece);
|
||||
|
||||
// Todo Implementation goes here
|
||||
|
||||
//sends the spectator-message
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
|
||||
@@ -1492,8 +1758,6 @@ public void testMovePieceToCeremony() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), movePiece);
|
||||
|
||||
// Todo Implementation goes here
|
||||
|
||||
//sends the spectator-message
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
|
||||
@@ -1515,12 +1779,45 @@ public void testStayInChoosePowerCard() {
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnState into movePiece
|
||||
//sends the turnState into choosePowerCardPiece
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePowerCard);
|
||||
// Todo Implementation goes here
|
||||
|
||||
//tests if the client is still in the choosePowercard-State
|
||||
//send all messages, that don't indicate a state-change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
//clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage);
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
//TODO selectable pieces
|
||||
|
||||
//tests if the client is still in the choosePowerCard-State
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(),turnState);
|
||||
assertEquals(turnState.getState(),choosePowerCard);
|
||||
@@ -1547,7 +1844,8 @@ public void testChoosePowerCardToRollDice() {
|
||||
powerCard.setState(choosePowerCard);
|
||||
assertEquals(powerCard.getState(), choosePowerCard);
|
||||
|
||||
//todo send the messages, to force a state change to rollDice
|
||||
//sends the rollDice-Message
|
||||
clientGameLogic.received(diceNow);
|
||||
|
||||
//tests if the turnState is in RollDice
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1576,7 +1874,8 @@ public void testChoosePowerCardToSwap() {
|
||||
powerCard.setState(choosePowerCard);
|
||||
assertEquals(powerCard.getState(), choosePowerCard);
|
||||
|
||||
//todo send the messages, to force a state change to swap
|
||||
//sends the TODO selectable Pieces
|
||||
clientGameLogic.received();
|
||||
|
||||
//tests if the client is in Swap
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1606,7 +1905,8 @@ public void testChoosePowerCardToShield() {
|
||||
powerCard.setState(choosePowerCard);
|
||||
assertEquals(powerCard.getState(), choosePowerCard);
|
||||
|
||||
//todo send the messages, to force a state change to shield
|
||||
//sends the TODO
|
||||
clientGameLogic.received();
|
||||
|
||||
//tests if the client is in Shield
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1636,7 +1936,38 @@ public void testStayInShield() {
|
||||
powerCard.setState(shield);
|
||||
assertEquals(powerCard.getState(), shield);
|
||||
|
||||
//todo send the messages, which dont force a statechange
|
||||
//send the messages, which don't force a statechange
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage); commented out, because it indicate a state-change to interrupt
|
||||
//clientGameLogic.received(playCardSwap);
|
||||
//clientGameLogic.received(playCardShield);
|
||||
//clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1650,7 +1981,7 @@ public void testStayInShield() {
|
||||
*/
|
||||
@Test
|
||||
public void testShieldToPowerCardEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
//sends the ClientGameLogic in GameState
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
@@ -1658,15 +1989,55 @@ public void testShieldToPowerCardEndState() {
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnStatemachine in PowerCard
|
||||
//sends the turnState in PowerCard
|
||||
turnState.setState(powerCard);
|
||||
assertEquals(turnState.getState(), powerCard);
|
||||
|
||||
//sends the turnStatemachine in Shield
|
||||
//sends the turnState in Shield
|
||||
powerCard.setState(shield);
|
||||
assertEquals(powerCard.getState(), shield);
|
||||
|
||||
//todo send the message to force the statechange
|
||||
//sends all messages that don't indicate a state-change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage);
|
||||
//clientGameLogic.received(playCardSwap);
|
||||
//clientGameLogic.received(playCardShield);
|
||||
//clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client is still in shield
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
assertEquals(turnState.getState(), powerCard);
|
||||
assertEquals(powerCard.getState(), shield);
|
||||
|
||||
//sends the playPowerCardMessage
|
||||
clientGameLogic.received(playCardShield);
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1687,11 +2058,11 @@ public void testSwapToPowerCardEndState() {
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnStatemachine in PowerCard
|
||||
//sends the turnState in PowerCard
|
||||
turnState.setState(powerCard);
|
||||
assertEquals(turnState.getState(), powerCard);
|
||||
|
||||
//sends the turnStatemachine in Swap
|
||||
//sends the turnState in Swap
|
||||
powerCard.setState(swap);
|
||||
assertEquals(powerCard.getState(), swap);
|
||||
|
||||
@@ -1720,11 +2091,42 @@ public void testNoPieceInWaitingPiece() {
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//sends the choosePiecemachine in NoPiece
|
||||
//sends the choosePiece in NoPiece
|
||||
turnState.setState(noPiece);
|
||||
assertEquals(choosePiece.getState(), noPiece);
|
||||
|
||||
//Todo test other messages, that there is no state change
|
||||
//send other messages, that there is no state change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
//clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage); commented out, because it indicate a statechange to interrupt
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
//clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
//clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//sends to the clientGameLogic the message WaitPiece
|
||||
clientGameLogic.received(waitPiece);
|
||||
@@ -1748,18 +2150,49 @@ public void testNoPieceInSelectedPiece() {
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnStatemachine in ChoosePiece
|
||||
//sends the turnState in ChoosePiece
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//sends the choosePiecemachine in NoPiece
|
||||
//sends the choosePiece in NoPiece
|
||||
choosePiece.setState(noPiece);
|
||||
assertEquals(choosePiece.getState(), noPiece);
|
||||
|
||||
//Todo test other messages, that there is no state change
|
||||
//send other messages, to test that there is no state change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
//clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage);
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
//clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
//clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
//clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//sends to the clientGameLogic the message SelectPiece
|
||||
clientGameLogic.received(selectPiece);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
@@ -1772,7 +2205,7 @@ public void testNoPieceInSelectedPiece() {
|
||||
*/
|
||||
@Test
|
||||
public void testNoPieceInStartPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
//sends the ClientGameLogic in GameState
|
||||
clientGameLogic.setState(gameState);
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
@@ -1780,15 +2213,46 @@ public void testNoPieceInStartPiece() {
|
||||
gameState.setState(turnState);
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnStatemachine in ChoosePiece
|
||||
//sends the turnState in ChoosePiece
|
||||
turnState.setState(choosePiece);
|
||||
assertEquals(turnState.getState(), choosePiece);
|
||||
|
||||
//sends the choosePiecemachine in NoPiece
|
||||
//sends the choosePiece in NoPiece
|
||||
choosePiece.setState(noPiece);
|
||||
assertEquals(choosePiece.getState(), noPiece);
|
||||
|
||||
//Todo test other messages, that there is no state change
|
||||
//sends other messages, that there is no state change
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
//clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage);
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponce);
|
||||
clientGameLogic.received(rankingRollAgain);
|
||||
clientGameLogic.received(reconnectBriefing);
|
||||
clientGameLogic.received(resumeGame);
|
||||
clientGameLogic.received(startGame);
|
||||
//clientGameLogic.received(startPieceMessage);
|
||||
clientGameLogic.received(updateReady);
|
||||
clientGameLogic.received(updateTSK);
|
||||
//clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
//clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//sends to the clientGameLogic the message StartPiece
|
||||
clientGameLogic.received(startPieceMessage);
|
||||
@@ -2025,6 +2489,7 @@ public void testStartPieceToChoosePieceEndState() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//tests if the client ist still in StartPiece
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -2089,6 +2554,7 @@ public void testRollRankingDiceToWaitRanking() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//test if the client is still in rollRankingDice
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -2152,6 +2618,7 @@ public void testWaitRankingToRollRankingDice() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//test if the client is still in waitRanking
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -2215,6 +2682,7 @@ public void testWaitRankingToEndStateDetermineStartingPlayer() {
|
||||
clientGameLogic.received(updateTSK);
|
||||
clientGameLogic.received(waitPiece);
|
||||
clientGameLogic.received(spectatorMessage);
|
||||
clientGameLogic.received(selectPieceMessage);
|
||||
|
||||
//test if the client is still in waitRanking
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
|
||||
Reference in New Issue
Block a user