added one testmethod in pieceTest
This commit is contained in:
@@ -5,11 +5,16 @@
|
||||
import pp.mdga.message.client.RequestDieMessage;
|
||||
import pp.mdga.message.client.RequestMoveMessage;
|
||||
import pp.mdga.message.server.MoveMessage;
|
||||
import pp.mdga.message.server.SelectPieceMessage;
|
||||
import pp.mdga.message.server.ServerMessage;
|
||||
import pp.mdga.server.ServerGameLogic;
|
||||
import pp.mdga.server.ServerSender;
|
||||
import pp.mdga.server.automaton.GameState;
|
||||
import pp.mdga.server.automaton.game.TurnState;
|
||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
||||
import pp.mdga.server.automaton.game.turn.choosepiece.SelectPieceState;
|
||||
import pp.mdga.server.automaton.game.turn.rolldice.FirstRollState;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -50,6 +55,15 @@ public class PieceTest {
|
||||
private int IDHost = 1;
|
||||
private int IDClient = 2;
|
||||
|
||||
//declare states
|
||||
GameState gameState;
|
||||
TurnState turnState;
|
||||
RollDiceState rollDiceState;
|
||||
FirstRollState firstRollState;
|
||||
ChoosePieceState choosePieceState;
|
||||
SelectPieceState selectPieceState;
|
||||
|
||||
|
||||
//declare messages here
|
||||
|
||||
@Before
|
||||
@@ -126,6 +140,14 @@ public void disconnectClient(int id) {
|
||||
|
||||
//set the active color todo necessary?
|
||||
game.setActiveColor(clientColor);
|
||||
|
||||
//initializes the states
|
||||
gameState= serverGameLogic.getGameState();
|
||||
turnState= gameState.getTurnState();
|
||||
rollDiceState= turnState.getRollDiceState();
|
||||
firstRollState= rollDiceState.getFirstRollState();
|
||||
choosePieceState= turnState.getChoosePieceState();
|
||||
selectPieceState= choosePieceState.getSelectPieceState();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,22 +158,22 @@ public void disconnectClient(int id) {
|
||||
*/
|
||||
@Test
|
||||
public void testMove() {
|
||||
// TODO:
|
||||
//sends the server in selectPiece
|
||||
serverGameLogic.setCurrentState(serverGameLogic.getGameState());
|
||||
serverGameLogic.getGameState().setCurrentState(serverGameLogic.getGameState().getTurnState());
|
||||
serverGameLogic.getGameState().getTurnState().setCurrentState(turnState.getChoosePieceState());
|
||||
serverGameLogic.getGameState().getTurnState().getChoosePieceState(serverGameLogic.getGameState().getTurnState().getChoosePieceState().getSelectedPieceState());
|
||||
turnState.getChoosePieceState().setCurrentState(turnState.getChoosePieceState().getSelectPieceState());
|
||||
serverGameLogic.setCurrentState(gameState);
|
||||
serverGameLogic.getGameState().setCurrentState(turnState);
|
||||
serverGameLogic.getGameState().getTurnState().setCurrentState(choosePieceState);
|
||||
serverGameLogic.getGameState().getTurnState().getChoosePieceState().setCurrentState(selectPieceState);
|
||||
|
||||
//tests if the server is in selectPieces
|
||||
assertEquals(serverGameLogic.getCurrentState(),serverGameLogic.getGameState());
|
||||
assertEquals(serverGameLogic.getGameState().getCurrentState(), turnState);
|
||||
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
||||
assertEquals(gameState.getCurrentState(), turnState);
|
||||
assertEquals(turnState.getCurrentState(),choosePieceState);
|
||||
assertEquals(choosePieceState.getCurrentState(),selectPieceState);
|
||||
|
||||
//sets the active Player to host
|
||||
game.setActiveColor(hostColor);
|
||||
|
||||
//sets the die-class
|
||||
//sets the die-class todo
|
||||
|
||||
//sends the request-die-message
|
||||
serverGameLogic.received(new RequestDieMessage(),IDHost);
|
||||
@@ -272,15 +294,18 @@ public void testCantLeaveStartingField() {
|
||||
@Test
|
||||
public void testReachBonusField() {
|
||||
// TODO: Implement test logic for when a piece reaches a bonus field
|
||||
//sends the server in RollDice
|
||||
|
||||
BonusCard card = game.getDrawPile().get(0);
|
||||
//sets the active Player to Host
|
||||
game.setActiveColor(hostColor);
|
||||
|
||||
//sets the dice-seed to 4
|
||||
|
||||
//sets the pile
|
||||
|
||||
//sends the requestDice-Message
|
||||
serverGameLogic.setCurrentState(serverGameLogic.getGameState());
|
||||
|
||||
// requestMOve of hostPiece3
|
||||
//requestMOve of hostPiece3
|
||||
|
||||
//tests the position of hostPiece3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user