diff --git a/Projekte/mdga/model/src/test/java/pp/mdga/client/clientState/ClientStateTest.java b/Projekte/mdga/model/src/test/java/pp/mdga/client/clientState/ClientStateTest.java index 43e30ac5..fc665264 100644 --- a/Projekte/mdga/model/src/test/java/pp/mdga/client/clientState/ClientStateTest.java +++ b/Projekte/mdga/model/src/test/java/pp/mdga/client/clientState/ClientStateTest.java @@ -87,11 +87,9 @@ public class ClientStateTest { private MoveMessage moveMessage; private NoTurnMessage noTurn; private PauseGameMessage interruptMessage; - private PlayCardMessage playCardSwap; private PlayCardMessage playCardShield; private PlayCardMessage playCardTurbo; - private PossibleCardMessage possibleCard; private PossiblePieceMessage possiblePiece; private RankingResponseMessage rankingResponce; @@ -104,7 +102,6 @@ public class ClientStateTest { private UpdateTSKMessage updateTSK; private WaitPieceMessage waitPiece; - private int from; private String name; private Color color; @@ -112,7 +109,6 @@ public class ClientStateTest { private BonusCard shieldCard; private BonusCard turboCard; - @Before public void setUp() { //initialize the game @@ -127,9 +123,9 @@ public void send(ClientMessage msg) { }); //initialize the playerID - from=1234; - name="Daniel"; - color=Color.ARMY; + from = 1234; + name = "Daniel"; + color = Color.ARMY; swapCard = BonusCard.SWAP; shieldCard = BonusCard.SHIELD; turboCard = BonusCard.TURBO; @@ -146,13 +142,13 @@ public void send(ClientMessage msg) { lobbyAccept = new LobbyAcceptMessage(); lobbyDeny = new LobbyDenyMessage(); lobbyPlayerJoin = new LobbyPlayerJoinMessage(name); - lobbyPlayerLeave = new LobbyPlayerLeaveMessage(name,color); + lobbyPlayerLeave = new LobbyPlayerLeaveMessage(name, color); moveMessage = new MoveMessage("www");//Todo noTurn = new NoTurnMessage(); interruptMessage = new PauseGameMessage(); - playCardSwap = new PlayCardMessage(swapCard,"www");//Todo - playCardShield = new PlayCardMessage(shieldCard,"www");//Todo - playCardTurbo = new PlayCardMessage(turboCard,"www");//Todo + playCardSwap = new PlayCardMessage(swapCard, "www");//Todo + playCardShield = new PlayCardMessage(shieldCard, "www");//Todo + playCardTurbo = new PlayCardMessage(turboCard, "www");//Todo possibleCard = new PossibleCardMessage(); possiblePiece = new PossiblePieceMessage(); rankingResponce = new RankingResponseMessage(); @@ -161,20 +157,16 @@ public void send(ClientMessage msg) { resumeGame = new ResumeGameMessage(); startGame = new ServerStartGameMessage(); startPieceMessage = new StartPieceMessage("www"); //Todo wrong class - updateReady = new UpdateReadyMessage(color,true); - updateTSK = new UpdateTSKMessage(name,color); + updateReady = new UpdateReadyMessage(color, true); + updateTSK = new UpdateTSKMessage(name, color); waitPiece = new WaitPieceMessage(); interruptMessage = new PauseGameMessage(); - - - //initialize the settings mainSettings = settings.getMainSettings(); videoSettings = settings.getVideoSettings(); audioSettings = settings.getAudioSettings(); - settings = new SettingsState(clientGameLogic); - + settings = new SettingsState(); //initialize the states dialogs = clientGameLogic.getDialogs(); @@ -190,7 +182,7 @@ public void send(ClientMessage msg) { statistics = ceremony.getStatistics(); determineStartPlayer = gameState.getDetermineStartPlayer(); - waiting= gameState.getWaiting(); + waiting = gameState.getWaiting(); animation = gameState.getAnimation(); turnState = gameState.getTurn(); spectator = gameState.getSpectator(); @@ -200,7 +192,7 @@ public void send(ClientMessage msg) { powerCard = turnState.getPowerCard(); playPowerCard = turnState.getPlayPowerCard(); - rollDice= turnState.getRollDice(); + rollDice = turnState.getRollDice(); choosePiece = turnState.getChoosePiece(); movePiece = turnState.getMovePiece(); @@ -220,9 +212,9 @@ public void send(ClientMessage msg) { @Test public void testInitialStateClientState() { //tests if the clientGameLogic is in Dialogs - assertEquals(clientGameLogic.getState(),dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //tests if the statemachine is in StartDialog - assertEquals(dialogs.getState(),startDialog); + assertEquals(dialogs.getState(), startDialog); } /** @@ -232,21 +224,54 @@ public void testInitialStateClientState() { public void testDialogsToGame() { //tests if the client is in Dialogs clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState(),dialogs); + assertEquals(clientGameLogic.getState(), dialogs); - //TODO + //sends all messages, which don't indicate 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); + 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); Todo rightful message + clientGameLogic.received(startPieceMessage); + clientGameLogic.received(updateReady); + clientGameLogic.received(updateTSK); + clientGameLogic.received(waitPiece); + + //tests if the client is still in lobby + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), lobby); //sends the startGame-Message to the client clientGameLogic.received(startGame); //tests if the client is in the gameState after receiving the message - assertEquals(clientGameLogic.getState(),gameState); + assertEquals(clientGameLogic.getState(), gameState); //tests if the new State of the GameStateMachine is in DetermineStartPlayer assertEquals(gameState.getState(), determineStartPlayer); //tests if the new State of DetermineStartPlayer is RollRankingDice - assertEquals(determineStartPlayer.getState() ,rollDice); + assertEquals(determineStartPlayer.getState(), rollDice); } /** @@ -265,18 +290,49 @@ public void testDialogsToClientStateEndState() { public void testClientGameToCeremony() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState(),gameState); + assertEquals(clientGameLogic.getState(), gameState); - //TODO + clientGameLogic.received(activePlayer); + clientGameLogic.received(anyPiece); + clientGameLogic.received(briefing); + //clientGameLogic.received(ceremonyMessage); todo rightful message + 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); + + //tests if the client is still in game-state + assertEquals(clientGameLogic.getState(), gameState); //sends the Ceremony-Message to the client clientGameLogic.received(ceremonyMessage); //tests if the client is in the ceremony after receiving the message - assertEquals(clientGameLogic.getState() , ceremony); + assertEquals(clientGameLogic.getState(), ceremony); //tests if the state of ceremony is Podium - assertEquals(ceremony.getState() ,podium); + assertEquals(ceremony.getState(), podium); } /** @@ -286,15 +342,13 @@ public void testClientGameToCeremony() { public void testClientGameSubStatesToInterrupt() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState(),gameState); - - //TODO + assertEquals(clientGameLogic.getState(), gameState); //sends the Ceremony-Message to the client clientGameLogic.received(interruptMessage); //tests if the client-automaton is in the interrupt state - assertEquals(clientGameLogic.getState() ,interrupt); + assertEquals(clientGameLogic.getState(), interrupt); } /** @@ -304,11 +358,11 @@ public void testClientGameSubStatesToInterrupt() { public void testGameToDialogs() { //sends the client into the GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState(),gameState); + assertEquals(clientGameLogic.getState(), gameState); //TODO - assertEquals(clientGameLogic.getState(),dialogs); + assertEquals(clientGameLogic.getState(), dialogs); assertEquals(dialogs.getState(), startDialog); } @@ -319,11 +373,41 @@ public void testGameToDialogs() { public void testStayInInterrupt() { //sends the ClientAutomaton in Interrupt clientGameLogic.setState(interrupt); - assertEquals(clientGameLogic.getState(),interrupt); + assertEquals(clientGameLogic.getState(), interrupt); - //Todo send all messages except the continue-message + //sends all messages, which don't indicate 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); + 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); Todo rightful message + clientGameLogic.received(startGame); + clientGameLogic.received(startPieceMessage); + clientGameLogic.received(updateReady); + clientGameLogic.received(updateTSK); + clientGameLogic.received(waitPiece); - assertEquals(clientGameLogic.getState(),interrupt); + //tests if the client is in the interrupt + assertEquals(clientGameLogic.getState(), interrupt); } /** @@ -333,12 +417,13 @@ public void testStayInInterrupt() { public void testClientInterruptToGame() { //sends the ClientAutomaton in Interrupt clientGameLogic.setState(interrupt); - assertEquals(clientGameLogic.getState() ,interrupt); + assertEquals(clientGameLogic.getState(), interrupt); - //Todo sends the continue-message + //sends the continue message + clientGameLogic.received(resumeGame); //tests if the client is in the game - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); } /** @@ -348,12 +433,12 @@ public void testClientInterruptToGame() { public void testInterruptToDialogs() { //sends the ClientAutomaton in Interrupt clientGameLogic.setState(interrupt); - assertEquals(clientGameLogic.getState() ,interrupt); + assertEquals(clientGameLogic.getState(), interrupt); //Todo send the server-closed message and the leave option - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,startDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), startDialog); } /** @@ -363,16 +448,16 @@ public void testInterruptToDialogs() { public void testCeremonyToDialogs() { //send the client in the ceremony clientGameLogic.setState(ceremony); - assertEquals(clientGameLogic.getState() ,ceremony); + assertEquals(clientGameLogic.getState(), ceremony); //sends the ceremony machine in the statistics ceremony.setState(statistics); - assertEquals(ceremony.getState() ,statistics); + assertEquals(ceremony.getState(), statistics); //Todo simulate the button next - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,startDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), startDialog); } /** @@ -382,16 +467,16 @@ public void testCeremonyToDialogs() { public void testStartDialogToNetworkDialog1() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in StartDialog dialogs.setState(startDialog); - assertEquals(dialogs.getState() ,startDialog); + assertEquals(dialogs.getState(), startDialog); //todo simulate pushBtn as client or host - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), networkDialog); } /** @@ -401,16 +486,16 @@ public void testStartDialogToNetworkDialog1() { public void testStartDialogToNetworkDialog2() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in StartDialog dialogs.setState(startDialog); - assertEquals(dialogs.getState() ,startDialog); + assertEquals(dialogs.getState(), startDialog); //todo simulate pushBtn as client or host - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), networkDialog); } /** @@ -429,16 +514,16 @@ public void testStartDialogToDialogsEndState() { public void testNetworkDialogToStartDialog() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in NetworkDialog dialogs.setState(networkDialog); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(dialogs.getState(), networkDialog); //todo simulate pushBtn - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialog.getState() ,startDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialog.getState(), startDialog); } /** @@ -448,16 +533,16 @@ public void testNetworkDialogToStartDialog() { public void testNetworkDialogToNetworkDialog1() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in NetworkDialog dialogs.setState(networkDialog); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(dialogs.getState(), networkDialog); - //todo test receiving all messages and making input + //todo test input - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), networkDialog); } /** @@ -467,21 +552,21 @@ public void testNetworkDialogToNetworkDialog1() { public void testNetworkDialogToNetworkDialog2() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in NetworkDialog dialogs.setState(networkDialog); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(dialogs.getState(), networkDialog); //todo simulate try connect to server ith wrong variables - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState(),networkDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), networkDialog); //todo simulate try connect to server with send: join-lobby and received lobby-refuse-message - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), networkDialog); } /** @@ -491,16 +576,16 @@ public void testNetworkDialogToNetworkDialog2() { public void testNetworkDialogToLobby() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in NetworkDialog dialogs.setState(networkDialog); - assertEquals(dialogs.getState() ,networkDialog); + assertEquals(dialogs.getState(), networkDialog); //todo simulate connect to server with send lobby request - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState(),lobby); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), lobby); } /** @@ -510,16 +595,16 @@ public void testNetworkDialogToLobby() { public void testLobbyToStartDialog() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in Lobby dialogs.setState(lobby); - assertEquals(dialogs.getState() ,lobby); + assertEquals(dialogs.getState(), lobby); //todo simulate leave the lobby - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,startDialog); + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), startDialog); } /** @@ -529,16 +614,46 @@ public void testLobbyToStartDialog() { public void testStayInLobby() { // sends the clientGameLogic in StartDialog clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the DialogsState in Lobby dialogs.setState(lobby); - assertEquals(dialogs.getState() ,lobby); + assertEquals(dialogs.getState(), lobby); - //todo send all messages that dont indicate a change-state - assertEquals(clientGameLogic.getState() ,dialogs); - assertEquals(dialogs.getState() ,lobby); + //sends all messages, which don't indicate 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);//Todo rightful message + clientGameLogic.received(lobbyDeny);//Todo rightful message + 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); Todo rightful message + clientGameLogic.received(startPieceMessage); + clientGameLogic.received(updateReady); + clientGameLogic.received(updateTSK); + clientGameLogic.received(waitPiece); + + assertEquals(clientGameLogic.getState(), dialogs); + assertEquals(dialogs.getState(), lobby); } /** @@ -548,23 +663,23 @@ public void testStayInLobby() { public void testLobbyToRollRankingDice() { //sends the clientStatemachine in Dialogs clientGameLogic.setState(dialogs); - assertEquals(clientGameLogic.getState() ,dialogs); + assertEquals(clientGameLogic.getState(), dialogs); //sends the clientStatemachine in Lobby dialogs.setState(lobby); - assertEquals(dialogs.getState() ,lobby); + assertEquals(dialogs.getState(), lobby); //sends the message to start the game - clientGameLogic.received();//TODO message + clientGameLogic.received(startGame); //tests if the clientStateMachine is in the GameState - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //tests if the clientStateMachine is in the DetermineStartPlayer - assertEquals(gameState.getState() ,determineStartPlayer); + assertEquals(gameState.getState(), determineStartPlayer); //tests if the clientStateMachine is in the RollRankingDice - assertEquals(determineStartPlayer.getState() ,rollRankingDice); + assertEquals(determineStartPlayer.getState(), rollRankingDice); } /** @@ -574,17 +689,18 @@ public void testLobbyToRollRankingDice() { public void testDetermineStartPlayerToWait() { //sends the clientGameLogic into the gameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState into the DetermineStartPlayer-state gameState.setState(determineStartPlayer); - assertEquals(gameState.getState(),determineStartPlayer); + assertEquals(gameState.getState(), determineStartPlayer); - //TODO + //sends the message, that indicate a statechange to wait + clientGameLogic.received(noTurn); //tests if the client is in the Wait-State - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState(),waiting); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), waiting); } /** @@ -594,40 +710,51 @@ public void testDetermineStartPlayerToWait() { public void testWaitToAnimation() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the client in WaitState gameState.setState(waiting); - assertEquals(gameState.getState() ,waiting); + assertEquals(gameState.getState(), waiting); //sends the moveMessage - clientGameLogic.received(moveMessage); //Todo ??? richtige message + clientGameLogic.received(moveMessage); //tests if a piece is moved,that the client goes into Animation - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,animation); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), animation); //sends the client in WaitState gameState.setState(waiting); - assertEquals(gameState.getState() ,waiting); + assertEquals(gameState.getState(), waiting); //sends the playTurboCard-message - clientGameLogic.received(playCardTurbo); //Todo ??? richtige message + clientGameLogic.received(playCardTurbo); //tests if a powerCard is played,that the client goes into Animation - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,animation); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), animation); //sends the client in WaitState gameState.setState(waiting); - assertEquals(gameState.getState() ,waiting); + assertEquals(gameState.getState(), waiting); //sends the playTurboCard-message - clientGameLogic.received(die); //Todo ??? richtige message + clientGameLogic.received(die); //tests if a die is rolled,that the client goes into Animation - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,animation); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), animation); + + //sends the client in WaitState + gameState.setState(waiting); + assertEquals(gameState.getState(), waiting); + + //sends the activePlayer-message + clientGameLogic.received(activePlayer); + + //tests if a die is rolled,that the client goes into Animation + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), animation); } /** @@ -637,26 +764,26 @@ public void testWaitToAnimation() { public void testWaitToTurn() { //sends client in gameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Waiting gameState.setState(waiting); - assertEquals(gameState.getState() ,waiting); + assertEquals(gameState.getState(), waiting); //the client receives the message ActivePlayer clientGameLogic.received(activePlayer); //tests if the client is in GameState - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //tests if Client is in Turn - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //tests if Client is in PowerCard - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //tests if Client is in ChoosePowerCard - assertEquals(powerCard.getState() ,choosePowerCard); + assertEquals(powerCard.getState(), choosePowerCard); } /** @@ -666,17 +793,18 @@ public void testWaitToTurn() { public void testWaitToGameEndState() { //sends client in gameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Waiting gameState.setState(waiting); - assertEquals(gameState.getState() ,waiting); + assertEquals(gameState.getState(), waiting); - //Todo + //send the ceremony-Message + clientGameLogic.received(ceremonyMessage); //tests if the client is in the ceremony - assertEquals(clientGameLogic.getState() ,ceremony); - assertEquals(ceremony.getState(),podium); + assertEquals(clientGameLogic.getState(), ceremony); + assertEquals(ceremony.getState(), podium); } /** @@ -716,57 +844,59 @@ public void testSpectatorToGameEndState() { */ @Test public void testPowerCardSubStatesToPlayPowerCard() { - //sends the client in th e swap-state - + /** + * sends the client in the swap-state + */ //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PlayPowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the client in the ChoosePowerCard powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState(),swap); + assertEquals(powerCard.getState(), swap); - //TODO + //sends the playCardMessage + clientGameLogic.received(playCardShield); - //tests if the client is in rollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,playPowerCard); - - - - //send the client in the shield-state + //tests if the client is in playPowerCard + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); + /** + * send the client in the shield-state + */ //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PlayPowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the client in the ChoosePowerCard powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState(),shield); + assertEquals(powerCard.getState(), shield); - //TODO + //sends the playCardMessage + clientGameLogic.received(playCardShield); - //tests if the client is in rollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,playPowerCard); + //tests if the client is in playPowerCard + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); } /** @@ -778,26 +908,27 @@ public void testPowerCardSubStatesToPlayPowerCard() { public void testPowerCardSubStatesToRollDice() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PlayPowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the client in the ChoosePowerCard powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState(),choosePowerCard); + assertEquals(powerCard.getState(), choosePowerCard); - //TODO + //sends RollDiceMessage + clientGameLogic.received(diceNow); //tests if the client is in rollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,rollDice); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), rollDice); } /** @@ -807,22 +938,51 @@ public void testPowerCardSubStatesToRollDice() { public void testStayInPlayPowerCard() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PlayPowerCard turnState.setState(playPowerCard); - assertEquals(turnState.getState() ,playPowerCard); + assertEquals(turnState.getState(), playPowerCard); - //Todo send messages to test to stay in playPowerCard + //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); todo rightful message + 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); //tests if the client is in PlayPowerCard - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,playPowerCard); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); } /** @@ -832,23 +992,59 @@ public void testStayInPlayPowerCard() { public void testPlayPowerCardToRollDice() { //sends the ClientGameLogic in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PlayPowerCard turnState.setState(playPowerCard); - assertEquals(turnState.getState() ,playPowerCard); + assertEquals(turnState.getState(), playPowerCard); - //Todo send messages to test the transition in rollDice - //Todo test other messages, that there is no state change + //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); todo rightful message + 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); //tests if the client is in RollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,rollDice); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); + + //sends the die-message + clientGameLogic.received(diceNow); + + //tests if the client is in RollDice + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), rollDice); } /** @@ -858,22 +1054,51 @@ public void testPlayPowerCardToRollDice() { public void testStayInRollDice() { //sends the ClientGameLogic in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turn-state into the rollDice-state turnState.setState(rollDice); - assertEquals(turnState.getState(),rollDice); + assertEquals(turnState.getState(), rollDice); - //TODO + //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); //tests if the client is in RollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState(),rollDice); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), rollDice); } /** @@ -883,23 +1108,22 @@ public void testStayInRollDice() { public void testRollDiceToChoosePiece() { //sends the ClientGameLogic in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turn-state into the rollDice-state turnState.setState(rollDice); - assertEquals(turnState.getState(),rollDice); + assertEquals(turnState.getState(), rollDice); //TODO //tests if the client is in ChoosePiece-state - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,choosePiece); - assertEquals(choosePiece.getState(),noPiece); - + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), choosePiece); + assertEquals(choosePiece.getState(), noPiece); } /** @@ -909,75 +1133,73 @@ public void testRollDiceToChoosePiece() { public void testRollDiceToWait() { //sends the ClientGameLogic in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turn-state into the rollDice-state turnState.setState(rollDice); - assertEquals(turnState.getState(),rollDice); + assertEquals(turnState.getState(), rollDice); //TODO - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState(),waiting); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), waiting); } /** * UC-ClientState-36: Test the transition from ChoosePiece to Wait. - * + *
* this method tests the transition from noPiece to Wait */ @Test public void testChoosePieceToWait() { //sends the client into noPiece clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState into Turn gameState.setState(turnState); - assertEquals(gameState.getState(),turnState); + assertEquals(gameState.getState(), turnState); //sends the turnState into choosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState(),choosePiece); + assertEquals(turnState.getState(), choosePiece); //TODO //tests if the client is in the wait-state - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState(),waiting); - + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), waiting); } /** * UC-ClientState-37: Test the transition from ChoosePiece to MovePiece. - * + *
* this method tests the transition from noPiece to Wait */ @Test public void testChoosePieceToMovePiece() { //sends the client into noPiece clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState into Turn gameState.setState(turnState); - assertEquals(gameState.getState(),turnState); + assertEquals(gameState.getState(), turnState); //sends the turnState into choosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState(),choosePiece); + assertEquals(turnState.getState(), choosePiece); //Todo //tests if the client is in the movePiece-state - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState(),turnState); - assertEquals(turnState.getState(),movePiece); - + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), movePiece); } /** @@ -1019,26 +1241,26 @@ public void testStayInChoosePowerCard() { public void testChoosePowerCardToRollDice() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in ChoosePiece powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState() ,choosePowerCard); + assertEquals(powerCard.getState(), choosePowerCard); //todo send the messages, to force a state change to rollDice //tests if the turnState is in RollDice - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,rollDice); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), rollDice); } /** @@ -1048,27 +1270,27 @@ public void testChoosePowerCardToRollDice() { public void testChoosePowerCardToSwap() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in ChoosePiece powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState() ,choosePowerCard); + assertEquals(powerCard.getState(), choosePowerCard); //todo send the messages, to force a state change to swap //tests if the client is in Swap - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,powerCard); - assertEquals(powerCard.getState() ,swap); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), powerCard); + assertEquals(powerCard.getState(), swap); } /** @@ -1078,27 +1300,27 @@ public void testChoosePowerCardToSwap() { public void testChoosePowerCardToShield() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in ChoosePiece powerCard.setState(choosePowerCard); - assertEquals(powerCard.getState() ,choosePowerCard); + assertEquals(powerCard.getState(), choosePowerCard); //todo send the messages, to force a state change to shield //tests if the client is in Shield - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,powerCard); - assertEquals(powerCard.getState() ,shield); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), powerCard); + assertEquals(powerCard.getState(), shield); } /** @@ -1108,27 +1330,27 @@ public void testChoosePowerCardToShield() { public void testStayInShield() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in Shield powerCard.setState(shield); - assertEquals(powerCard.getState() ,shield); + assertEquals(powerCard.getState(), shield); //todo send the messages, which dont force a statechange //tests if the client is in PlayPowerCard - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,powerCard); - assertEquals(powerCard.getState() ,playPowerCard); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), powerCard); + assertEquals(powerCard.getState(), playPowerCard); } /** @@ -1138,26 +1360,26 @@ public void testStayInShield() { public void testShieldToPowerCardEndState() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in Shield powerCard.setState(shield); - assertEquals(powerCard.getState() ,shield); + assertEquals(powerCard.getState(), shield); //todo send the message to force the statechange //tests if the client is in PlayPowerCard - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,playPowerCard); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); } /** @@ -1167,26 +1389,26 @@ public void testShieldToPowerCardEndState() { public void testSwapToPowerCardEndState() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in PowerCard turnState.setState(powerCard); - assertEquals(turnState.getState() ,powerCard); + assertEquals(turnState.getState(), powerCard); //sends the turnStatemachine in Swap powerCard.setState(swap); - assertEquals(powerCard.getState() ,swap); + assertEquals(powerCard.getState(), swap); //todo send the message to force the statechange //tests if the client is in PlayPowerCard - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,playPowerCard); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), playPowerCard); } /** @@ -1196,29 +1418,29 @@ public void testSwapToPowerCardEndState() { public void testNoPieceInWaitingPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePiecemachine in NoPiece turnState.setState(noPiece); - assertEquals(choosePiece.getState() ,noPiece); + assertEquals(choosePiece.getState(), noPiece); //Todo test other messages, that there is no state change //sends to the clientGameLogic the message WaitPiece clientGameLogic.received(waitPiece); - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,waitingPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), waitingPiece); } /** @@ -1228,29 +1450,29 @@ public void testNoPieceInWaitingPiece() { public void testNoPieceInSelectedPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePiecemachine in NoPiece choosePiece.setState(noPiece); - assertEquals(choosePiece.getState() ,noPiece); + assertEquals(choosePiece.getState(), noPiece); //Todo test other messages, that there is no state change //sends to the clientGameLogic the message SelectPiece clientGameLogic.received(selectPiece); - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,selectPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), selectPiece); } /** @@ -1260,29 +1482,29 @@ public void testNoPieceInSelectedPiece() { public void testNoPieceInStartPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePiecemachine in NoPiece choosePiece.setState(noPiece); - assertEquals(choosePiece.getState() ,noPiece); + assertEquals(choosePiece.getState(), noPiece); //Todo test other messages, that there is no state change //sends to the clientGameLogic the message StartPiece clientGameLogic.received(startPieceMessage); - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,startPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), startPiece); } /** @@ -1292,28 +1514,28 @@ public void testNoPieceInStartPiece() { public void testNoPieceInWait() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePiecemachine in NoPiece choosePiece.setState(noPiece); - assertEquals(choosePiece.getState() ,noPiece); + assertEquals(choosePiece.getState(), noPiece); //Todo test other messages, that there is no state change //sends to the clientGameLogic the message NoTurn clientGameLogic.received(noTurn); - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,waiting); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), waiting); } /** @@ -1323,26 +1545,26 @@ public void testNoPieceInWait() { public void testStayInWaitingPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePiecemachine in WaitingPiece choosePiece.setState(waitingPiece); - assertEquals(choosePiece.getState() ,waitingPiece); + assertEquals(choosePiece.getState(), waitingPiece); //TODO send all sever-messages except ... to the clientGameLogic to test there are no state change - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,waitingPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), waitingPiece); } /** @@ -1352,25 +1574,25 @@ public void testStayInWaitingPiece() { public void testWaitingPieceInChoosePieceEndState() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePieceStatemachine in WaitingPiece choosePiece.setState(waitingPiece); - assertEquals(choosePiece.getState() ,waitingPiece); + assertEquals(choosePiece.getState(), waitingPiece); //Todo send the message to the clientGameLogic to force a state change - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,movePiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), movePiece); } /** @@ -1380,26 +1602,26 @@ public void testWaitingPieceInChoosePieceEndState() { public void testStayInSelectedPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePieceStatemachine in SelectPiece; choosePiece.setState(selectPiece); - assertEquals(choosePiece.getState() ,selectPiece); + assertEquals(choosePiece.getState(), selectPiece); //Todo send all server messages which dont force a state change here - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,selectPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), selectPiece); } /** @@ -1409,25 +1631,25 @@ public void testStayInSelectedPiece() { public void testSelectedPieceInChoosePieceEndState() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePieceStatemachine in SelectPiece choosePiece.setState(selectPiece); - assertEquals(choosePiece.getState() ,selectPiece); + assertEquals(choosePiece.getState(), selectPiece); //Todo send the message which force a state change - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,movePiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), movePiece); } /** @@ -1437,26 +1659,26 @@ public void testSelectedPieceInChoosePieceEndState() { public void testStayInStartPiece() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePieceStatemachine in StartPiece choosePiece.setState(startPiece); - assertEquals(choosePiece.getState() ,startPiece); + assertEquals(choosePiece.getState(), startPiece); //todo send all messages which dont force a state change - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,choosePiece); - assertEquals(choosePiece.getState() ,startPiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), choosePiece); + assertEquals(choosePiece.getState(), startPiece); } /** @@ -1466,25 +1688,25 @@ public void testStayInStartPiece() { public void testStartPieceToChoosePieceEndState() { //sends the ClientAutomaton in GameState clientGameLogic.setState(gameState); - assertEquals(clientGameLogic.getState() ,gameState); + assertEquals(clientGameLogic.getState(), gameState); //sends the gameState in the Turn gameState.setState(turnState); - assertEquals(gameState.getState() ,turnState); + assertEquals(gameState.getState(), turnState); //sends the turnStatemachine in ChoosePiece turnState.setState(choosePiece); - assertEquals(turnState.getState() ,choosePiece); + assertEquals(turnState.getState(), choosePiece); //sends the choosePieceStatemachine in StartPiece choosePiece.setState(startPiece); - assertEquals(choosePiece.getState() ,startPiece); + assertEquals(choosePiece.getState(), startPiece); //Todo send the message which force a state change - assertEquals(clientGameLogic.getState() ,gameState); - assertEquals(gameState.getState() ,turnState); - assertEquals(turnState.getState() ,movePiece); + assertEquals(clientGameLogic.getState(), gameState); + assertEquals(gameState.getState(), turnState); + assertEquals(turnState.getState(), movePiece); } /** @@ -1518,17 +1740,17 @@ public void testWaitRankingToEndStateDetermineStartingPlayer() { public void testPodiumToStatistics() { //sends the clientGameLogic into Ceremony clientGameLogic.setState(ceremony); - assertEquals(clientGameLogic.getState() ,ceremony); + assertEquals(clientGameLogic.getState(), ceremony); //sends the ceremony into podium ceremony.setState(podium); - assertEquals(ceremony.getState() ,podium); + assertEquals(ceremony.getState(), podium); //TODO //tests if the client is in statistics - assertEquals(clientGameLogic.getState() ,ceremony); - assertEquals(ceremony.getState(),statistics); + assertEquals(clientGameLogic.getState(), ceremony); + assertEquals(ceremony.getState(), statistics); } /** @@ -1585,12 +1807,12 @@ public void testMainSettingsToClientState() { public void testStayInVideoSettings() { //send the settings into AudioSettings settings.setState(audioSettings); - assertEquals(settings.getState(),audioSettings); + assertEquals(settings.getState(), audioSettings); //TODo //tests if the client is in the video-settings - assertEquals(settings.getState(),videoSettings); + assertEquals(settings.getState(), videoSettings); } /** @@ -1600,12 +1822,12 @@ public void testStayInVideoSettings() { public void testVideoSettingsToMainSettings() { //send the settings into AudioSettings settings.setState(videoSettings); - assertEquals(settings.getState(),videoSettings); + assertEquals(settings.getState(), videoSettings); //TODo //tests if the client is in the main-settings - assertEquals(settings.getState(),mainSettings); + assertEquals(settings.getState(), mainSettings); } /** @@ -1615,12 +1837,12 @@ public void testVideoSettingsToMainSettings() { public void testStayInAudioSettings() { //send the settings into AudioSettings settings.setState(audioSettings); - assertEquals(settings.getState(),audioSettings); + assertEquals(settings.getState(), audioSettings); //TODo //tests if the client is in the audio-settings - assertEquals(settings.getState(),audioSettings); + assertEquals(settings.getState(), audioSettings); } /** @@ -1630,12 +1852,12 @@ public void testStayInAudioSettings() { public void testAudioSettingsToMainSettings() { //send the settings into AudioSettings settings.setState(audioSettings); - assertEquals(settings.getState(),audioSettings); + assertEquals(settings.getState(), audioSettings); //TODo //tests if the client is in the main-settings - assertEquals(settings.getState(),mainSettings); + assertEquals(settings.getState(), mainSettings); } /** @@ -1645,5 +1867,4 @@ public void testAudioSettingsToMainSettings() { public void testClientStateSubStatesToMainSettings() { // todo Implementation goes here } - }