added javadocs
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
import static org.junit.Assert.assertTrue;
|
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 {
|
public class ClientStateTest {
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* this test-class tests the Testcases T132-T169
|
||||||
*/
|
*/
|
||||||
public class ServerStateTest {
|
public class ServerStateTest {
|
||||||
|
|
||||||
@@ -149,11 +149,18 @@ public void send(int id, ServerMessage msg) {
|
|||||||
interrupt = new Interrupt(serverAutomaton, logic, gameState);
|
interrupt = new Interrupt(serverAutomaton, logic, gameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this test-method tests, that the server, when initialized, is in the Lobby-state
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testInitialStateServerState() {
|
public void testInitialStateServerState() {
|
||||||
assertTrue(serverAutomaton.getState() instanceof Lobby);
|
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
|
@Test
|
||||||
public void testLobbyToDetermineStartPlayer() {
|
public void testLobbyToDetermineStartPlayer() {
|
||||||
//sends the server in the lobby-state
|
//sends the server in the lobby-state
|
||||||
@@ -170,6 +177,9 @@ public void testLobbyToDetermineStartPlayer() {
|
|||||||
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
|
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests, that the server stays in the Lobby
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStayInLobby() {
|
public void testStayInLobby() {
|
||||||
//sends the server in the lobby-state
|
//sends the server in the lobby-state
|
||||||
@@ -198,6 +208,9 @@ public void testStayInLobby() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof Lobby);
|
assertTrue(serverAutomaton.getState() instanceof Lobby);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests, that the server can go into the interrupt-state
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServerGameSubStatesToInterrupt() {
|
public void testServerGameSubStatesToInterrupt() {
|
||||||
//sends the server in the gameState
|
//sends the server in the gameState
|
||||||
@@ -225,6 +238,9 @@ public void testServerGameToCeremony() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof Ceremony);
|
assertTrue(serverAutomaton.getState() instanceof Ceremony);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests that the server goes back to the Game, when the ForceStartGame-message is issued
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testInterruptToGameContinue() {
|
public void testInterruptToGameContinue() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
@@ -238,6 +254,9 @@ public void testInterruptToGameContinue() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests, that the server goes back to the game, if the missing client has reconnected
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testInterruptToGameReconnect() {
|
public void testInterruptToGameReconnect() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
@@ -250,6 +269,9 @@ public void testInterruptToGameReconnect() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
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
|
@Test
|
||||||
public void testInterruptToGameTimer() {
|
public void testInterruptToGameTimer() {
|
||||||
//sends the server in the Interrupt-State
|
//sends the server in the Interrupt-State
|
||||||
@@ -262,12 +284,18 @@ public void testInterruptToGameTimer() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof GameState);
|
assertTrue(serverAutomaton.getState() instanceof GameState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests, that the server closes, if the ceremony has ended
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCeremonyToServerStateEndState() {
|
public void testCeremonyToServerStateEndState() {
|
||||||
// TODO: Implement test logic for transition from Ceremony to Server State End State
|
// TODO: Implement test logic for transition from Ceremony to Server State End State
|
||||||
// TODO how????
|
// TODO how????
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests that the server stays in DetermineStartPlayer, when issued messages
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -285,6 +313,9 @@ public void testDetermineStartPlayerToDetermineStartPlayer1() {
|
|||||||
assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
|
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
|
@Test
|
||||||
public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -302,6 +333,9 @@ public void testDetermineStartPlayerToDetermineStartPlayer2() {
|
|||||||
assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
|
assertTrue(gameStateMachine.getState() instanceof DetermineStartPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this method tests that the server goes into Animation-state, if there is an order
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDetermineStartPlayerToAnimation() {
|
public void testDetermineStartPlayerToAnimation() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -319,6 +353,10 @@ public void testDetermineStartPlayerToAnimation() {
|
|||||||
assertTrue(gameStateMachine.getState() instanceof Animation);
|
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
|
@Test
|
||||||
public void testAnimationToPowerCard() {
|
public void testAnimationToPowerCard() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -345,6 +383,10 @@ public void testAnimationToPowerCard() {
|
|||||||
assertTrue(turnStateMachine.getState() instanceof PowerCard);
|
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
|
@Test
|
||||||
public void testTurnToAnimation() {
|
public void testTurnToAnimation() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -362,6 +404,10 @@ public void testTurnToAnimation() {
|
|||||||
assertTrue(gameStateMachine.getState() instanceof Animation);
|
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
|
@Test
|
||||||
public void testTurnToGameEndState() {
|
public void testTurnToGameEndState() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
@@ -378,6 +424,10 @@ public void testTurnToGameEndState() {
|
|||||||
assertTrue(serverAutomaton.getState() instanceof Ceremony);
|
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
|
@Test
|
||||||
public void testStayInPowerCard() {
|
public void testStayInPowerCard() {
|
||||||
//sends the server in Game-State
|
//sends the server in Game-State
|
||||||
|
|||||||
Reference in New Issue
Block a user