added the empty testmethods in serverstateTest and edited the testmethods for substates of choocePiece in Client into MovePiece

This commit is contained in:
Benjamin Feyer
2024-11-24 18:21:26 +01:00
parent f18a62b089
commit a71619612a
2 changed files with 333 additions and 9 deletions

View File

@@ -13,7 +13,7 @@
import static org.junit.Assert.assertTrue;
/**
* this test-class tests the testcases T232-T239
* this test-class tests the testcases T232-T239 TODO
*/
public class ClientStateTest {
@@ -211,7 +211,7 @@ public void testDialogsToGame() {
assertTrue(clientAutomaton.getState() instanceof GameState);
//tests if the new State of the GameStateMachine is in DetermineStartPlayer
GameState gameState1= clientAutomaton.getState();
GameState gameState1 = clientAutomaton.getState();
GameStateMachine gameStateMachine1 = (GameStateMachine) gameState1.getState();
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
@@ -840,7 +840,7 @@ public void testNoPieceInStartPiece() {
*/
@Test
public void testNoPieceInWait() {
//TODO
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
@@ -872,7 +872,28 @@ public void testNoPieceInWait() {
*/
@Test
public void testStayInWaitingPiece() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in WaitingPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(waitingPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
//TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
}
/**
@@ -880,7 +901,28 @@ public void testStayInWaitingPiece() {
*/
@Test
public void testWaitingPieceInChoosePieceEndState() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in WaitingPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(waitingPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof WaitingPiece);
//Todo send the message to the clientGameLogic to force a state change
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
}
/**
@@ -888,7 +930,28 @@ public void testWaitingPieceInChoosePieceEndState() {
*/
@Test
public void testStayInSelectedPiece() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in SelectPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(selectPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
//Todo send all server messages which dont force a state change here
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
}
/**
@@ -896,7 +959,28 @@ public void testStayInSelectedPiece() {
*/
@Test
public void testSelectedPieceInChoosePieceEndState() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in SelectPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(selectPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof SelectPiece);
//Todo send the message which force a state change
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
}
/**
@@ -904,7 +988,28 @@ public void testSelectedPieceInChoosePieceEndState() {
*/
@Test
public void testStayInStartPiece() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in StartPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(startPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
//todo send all messages which dont force a state change
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
}
/**
@@ -912,7 +1017,28 @@ public void testStayInStartPiece() {
*/
@Test
public void testStartPieceToChoosePieceEndState() {
// Implementation goes here
//sends the ClientAutomaton in GameState
clientAutomaton.goto(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
//sends the gameStateMachine in the Turn
GameStateMachine gameStateMachine1 = gameState.getGameStateMachine();
gameStateMachine1.goto(turn);
assertTrue(gameStateMachine1.getState() instanceof Turn);
//sends the turnStatemachine in ChoosePiece
TurnStateMachine turnStateMachine1 = turn.getTurnStateMachine();
turnStateMachine1.goto(choosePiece);
assertTrue(turnStateMachine1.getState() instanceof ChoosePiece);
//sends the choosePieceStatemachine in StartPiece
ChoosePieceStateMachine choosePieceStateMachine1 = choosePiece.getChoosePieceStateMachine();
choosePieceStateMachine1.goto(startPiece);
assertTrue(choosePieceStateMachine1.getState() instanceof StartPiece);
//Todo send the message which force a state change
assertTrue(turnStateMachine1.getState() instanceof MovePiece);
}
/**

View File

@@ -368,4 +368,202 @@ public void testTurnToGameEndState() {
public void testStayInPowerCard() {
// TODO: Implement test logic for staying in Power Card state
}
/**
* Tests the transition from PowerCard state to PlayPowerCard state.
* UC-ServerState-17
*/
@Test
public void testPowerCardToPlayPowerCard() {
// UC-ServerState-17
}
/**
* Tests the transition from PlayPowerCard state to RollDice state.
* UC-ServerState-18
*/
@Test
public void testPlayPowerCardToRollDice() {
// UC-ServerState-18
}
/**
* Tests the transition from ChoosePiece state to MovePiece state.
* UC-ServerState-19
*/
@Test
public void testChoosePieceToMovePiece() {
// UC-ServerState-19
}
/**
* Tests the transition from MovePiece state to TurnEndState.
* UC-ServerState-20
*/
@Test
public void testMovePiecetoTurnEndState() {
// UC-ServerState-20
}
/**
* Tests the transition from MovePiece state to FirstRoll state.
* UC-ServerState-21
*/
@Test
public void testMovePieceToFirstRoll() {
// UC-ServerState-21
}
/**
* Tests the transition from FirstRoll state to RollDiceEndState.
* UC-ServerState-22
*/
@Test
public void testFirstRollToRollDiceEndState() {
// UC-ServerState-22
}
/**
* Tests the transition from FirstRoll state to SecondRoll state.
* UC-ServerState-23
*/
@Test
public void testFirstRollToSecondRoll() {
// UC-ServerState-23
}
/**
* Tests the transition from SecondRoll state to RollDiceEndState.
* UC-ServerState-24
*/
@Test
public void testSecondRollToRollDiceEndState() {
// UC-ServerState-24
}
/**
* Tests the transition from SecondRoll state to ThirdRoll state.
* UC-ServerState-25
*/
@Test
public void testSecondRollToThirdRoll() {
// UC-ServerState-25
}
/**
* Tests the transition from ThirdRoll state to RollDiceEndState.
* UC-ServerState-26
*/
@Test
public void testThirdRollToRollDiceEndState() {
// UC-ServerState-26
}
/**
* Tests the transition from ThirdRoll state to TurnEndState.
* UC-ServerState-27
*/
@Test
public void testThirdRollToTurnEndState() {
// UC-ServerState-27
}
/**
* Tests the transition from NoPiece state to WaitingPiece state.
* UC-ServerState-28
*/
@Test
public void testNoPieceToWaitingPiece() {
// UC-ServerState-28
}
/**
* Tests the transition from NoPiece state to NoTurn state.
* UC-ServerState-29
*/
@Test
public void testNoPieceToNoTurn() {
// UC-ServerState-29
}
/**
* Tests the transition from NoTurn state to TurnEndState.
* UC-ServerState-30
*/
@Test
public void testNoTurnToTurnEndState() {
// UC-ServerState-30
}
/**
* Tests that the system stays in the WaitingPiece state.
* UC-ServerState-31
*/
@Test
public void testStayInWaitingPiece() {
// UC-ServerState-31
}
/**
* Tests the transition from WaitingPiece state to MovePiece state.
* UC-ServerState-32
*/
@Test
public void testWaitingPieceToMovePiece() {
// UC-ServerState-32
}
/**
* Tests the transition from NoPiece state to SelectPiece state.
* UC-ServerState-33
*/
@Test
public void testNoPieceToSelectPiece() {
// UC-ServerState-33
}
/**
* Tests the transition from NoPiece state to StartPiece state.
* UC-ServerState-34
*/
@Test
public void testNoPieceToStartPiece() {
// UC-ServerState-34
}
/**
* Tests that the system stays in the SelectPiece state.
* UC-ServerState-35
*/
@Test
public void testStayInSelectPiece() {
// UC-ServerState-35
}
/**
* Tests the transition from SelectPiece state to MovePiece state.
* UC-ServerState-36
*/
@Test
public void testSelectPieceToMovePiece() {
// UC-ServerState-36
}
/**
* Tests that the system stays in the StartPiece state.
* UC-ServerState-37
*/
@Test
public void testStayInStartPiece() {
// UC-ServerState-37
}
/**
* Tests the transition from StartPiece state to MovePiece state.
* UC-ServerState-38
*/
@Test
public void testStartPieceToMovePiece() {
// UC-ServerState-38
}
}