added javadocs

This commit is contained in:
Benjamin Feyer
2024-11-25 02:30:43 +01:00
committed by Felix
parent 461a497353
commit e18ea15efa
2 changed files with 52 additions and 2 deletions

View File

@@ -16,7 +16,7 @@
import static org.junit.Assert.assertTrue;
/**
* this test-class tests the testcases T232-T239 TODO
* this test-class tests the testcases T170-T239
*/
public class ClientStateTest {

View File

@@ -10,7 +10,7 @@
import static org.junit.Assert.*;
/**
* TODO
* this test-class tests the Testcases T132-T169
*/
public class ServerStateTest {
@@ -149,11 +149,18 @@ public void send(int id, ServerMessage msg) {
interrupt = new Interrupt(serverAutomaton, logic, gameState);
}
/**
* this test-method tests, that the server, when initialized, is in the Lobby-state
*/
@Test
public void testInitialStateServerState() {
assertTrue(serverAutomaton.getState() instanceof Lobby);
}
/**
* this method tests that the server, if all players are ready and the startGameMessage is issued,
* changes into the DetermineStartPlayer-state
*/
@Test
public void testLobbyToDetermineStartPlayer() {
//sends the server in the lobby-state
@@ -170,6 +177,9 @@ public void testLobbyToDetermineStartPlayer() {
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
}
/**
* this method tests, that the server stays in the Lobby
*/
@Test
public void testStayInLobby() {
//sends the server in the lobby-state
@@ -198,6 +208,9 @@ public void testStayInLobby() {
assertTrue(serverAutomaton.getState() instanceof Lobby);
}
/**
* this method tests, that the server can go into the interrupt-state
*/
@Test
public void testServerGameSubStatesToInterrupt() {
//sends the server in the gameState
@@ -225,6 +238,9 @@ public void testServerGameToCeremony() {
assertTrue(serverAutomaton.getState() instanceof Ceremony);
}
/**
* this method tests that the server goes back to the Game, when the ForceStartGame-message is issued
*/
@Test
public void testInterruptToGameContinue() {
//sends the server in the Interrupt-State
@@ -238,6 +254,9 @@ public void testInterruptToGameContinue() {
assertTrue(serverAutomaton.getState() instanceof GameState);
}
/**
* this method tests, that the server goes back to the game, if the missing client has reconnected
*/
@Test
public void testInterruptToGameReconnect() {
//sends the server in the Interrupt-State
@@ -250,6 +269,9 @@ public void testInterruptToGameReconnect() {
assertTrue(serverAutomaton.getState() instanceof GameState);
}
/**
* this method tests, that th e server continues with the game, if there is no time left on the timer
*/
@Test
public void testInterruptToGameTimer() {
//sends the server in the Interrupt-State
@@ -262,12 +284,18 @@ public void testInterruptToGameTimer() {
assertTrue(serverAutomaton.getState() instanceof GameState);
}
/**
* this method tests, that the server closes, if the ceremony has ended
*/
@Test
public void testCeremonyToServerStateEndState() {
// TODO: Implement test logic for transition from Ceremony to Server State End State
// TODO how????
}
/**
* this method tests that the server stays in DetermineStartPlayer, when issued messages
*/
@Test
public void testDetermineStartPlayerToDetermineStartPlayer1() {
//sends the server in Game-State
@@ -285,6 +313,9 @@ public void testDetermineStartPlayerToDetermineStartPlayer1() {
assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
}
/**
* this method tests that the server stays in DetermineStartPlayer, when all players are ranked and two of the highest are even
*/
@Test
public void testDetermineStartPlayerToDetermineStartPlayer2() {
//sends the server in Game-State
@@ -302,6 +333,9 @@ public void testDetermineStartPlayerToDetermineStartPlayer2() {
assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
}
/**
* this method tests that the server goes into Animation-state, if there is an order
*/
@Test
public void testDetermineStartPlayerToAnimation() {
//sends the server in Game-State
@@ -319,6 +353,10 @@ public void testDetermineStartPlayerToAnimation() {
assertTrue(gameStateMachine.getState() instanceof Animation);
}
/**
* tests that the server goes from the animation-state into PowerCardState, if the animation in the client has ended
* and all players have issued a animationEndMessage
*/
@Test
public void testAnimationToPowerCard() {
//sends the server in Game-State
@@ -345,6 +383,10 @@ public void testAnimationToPowerCard() {
assertTrue(turnStateMachine.getState() instanceof PowerCard);
}
/**
* this method tests that the server changes it's state from the turn-state to the animation-state, if there are at
* least two player left
*/
@Test
public void testTurnToAnimation() {
//sends the server in Game-State
@@ -362,6 +404,10 @@ public void testTurnToAnimation() {
assertTrue(gameStateMachine.getState() instanceof Animation);
}
/**
* this method tests that the server changes it's state from the turn-state to the ceremony-state,
* if there is only one player left
*/
@Test
public void testTurnToGameEndState() {
//sends the server in Game-State
@@ -378,6 +424,10 @@ public void testTurnToGameEndState() {
assertTrue(serverAutomaton.getState() instanceof Ceremony);
}
/**
* this method tests that the server don't change it's state whe issued with messages,
* which don't implicate a statechange
*/
@Test
public void testStayInPowerCard() {
//sends the server in Game-State