implemented more tests for the clientStartgame

This commit is contained in:
Benjamin Feyer
2024-11-29 00:13:06 +01:00
parent fad853b34a
commit eff011f69f

View File

@@ -1802,7 +1802,62 @@ public void testStartPieceToChoosePieceEndState() {
*/
@Test
public void testRollRankingDiceToWaitRanking() {
// Todo Implementation goes here
//sends the ClientAutomaton in GameState
clientGameLogic.setState(gameState);
assertEquals(clientGameLogic.getState(), gameState);
//sends the gameState in the determineStartPlayer
gameState.setState(determineStartPlayer);
assertEquals(gameState.getState(), determineStartPlayer);
//sends the turnStatemachine in ChoosePiece
determineStartPlayer.setState(rollRankingDice);
assertEquals(determineStartPlayer.getState(), rollRankingDice);
//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);
//test if the client is still in rollRankingDice
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),determineStartPlayer);
assertEquals(determineStartPlayer.getState(),rollRankingDice);
//sends die-message
clientGameLogic.received(die);
//test if the client is in waitRanking
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),determineStartPlayer);
assertEquals(determineStartPlayer.getState(),waitRanking);
}
/**
@@ -1810,7 +1865,62 @@ public void testRollRankingDiceToWaitRanking() {
*/
@Test
public void testWaitRankingToRollRankingDice() {
// Todo Implementation goes here
//sends the ClientAutomaton in GameState
clientGameLogic.setState(gameState);
assertEquals(clientGameLogic.getState(), gameState);
//sends the gameState in the determineStartPlayer
gameState.setState(determineStartPlayer);
assertEquals(gameState.getState(), determineStartPlayer);
//sends the turnStatemachine in ChoosePiece
determineStartPlayer.setState(waitRanking);
assertEquals(determineStartPlayer.getState(), waitRanking);
//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);
//test if the client is still in waitRanking
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),determineStartPlayer);
assertEquals(determineStartPlayer.getState(),waitRanking);
//sends rankingRollAgain-message
clientGameLogic.received(rankingRollAgain);
//test if the client is in rollRankingDice
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),determineStartPlayer);
assertEquals(determineStartPlayer.getState(),rollRankingDice);
}
/**
@@ -1818,7 +1928,61 @@ public void testWaitRankingToRollRankingDice() {
*/
@Test
public void testWaitRankingToEndStateDetermineStartingPlayer() {
// Todo Implementation goes here
//sends the ClientAutomaton in GameState
clientGameLogic.setState(gameState);
assertEquals(clientGameLogic.getState(), gameState);
//sends the gameState in the determineStartPlayer
gameState.setState(determineStartPlayer);
assertEquals(gameState.getState(), determineStartPlayer);
//sends the turnStatemachine in ChoosePiece
determineStartPlayer.setState(waitRanking);
assertEquals(determineStartPlayer.getState(), waitRanking);
//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);
//test if the client is still in waitRanking
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),determineStartPlayer);
assertEquals(determineStartPlayer.getState(),waitRanking);
//sends endOfTurn-message
clientGameLogic.received(endOfTurn);
//test if the client is in wait
assertEquals(clientGameLogic.getState(), gameState);
assertEquals(gameState.getLogic(),waiting);
}
/**
@@ -1846,8 +2010,19 @@ public void testPodiumToStatistics() {
*/
@Test
public void testStatisticsToCeremonyEndState() {
// Implementation goes here
//TODO
//sends the client in ceremony
clientGameLogic.setState(ceremony);
assertEquals(clientGameLogic.getState(), ceremony);
//sends the ceremony in statistics
ceremony.setState(statistics);
assertEquals(ceremony.getState(),statistics);
//TODO simulate button-push
//tests if client is in startDialog
assertEquals(clientGameLogic.getState(), dialogs);
assertEquals(dialogs.getState(),startDialog);
}
/**