added comments
This commit is contained in:
@@ -72,7 +72,7 @@ public class ClientStateTest {
|
||||
private EndOfTurnMessage endOfTurn;
|
||||
private LobbyAcceptMessage lobbyAccept;
|
||||
private LobbyDenyMessage lobbyDeny;
|
||||
private LobbyPlayerJoinMessage lobbyPlayerJoin;
|
||||
private LobbyPlayerJoinedMessage lobbyPlayerJoin;
|
||||
private LobbyPlayerLeaveMessage lobbyPlayerLeave;
|
||||
private MoveMessage moveMessage;
|
||||
private NoTurnMessage noTurn;
|
||||
@@ -130,13 +130,13 @@ public void send(ClientMessage msg) {
|
||||
anyPiece = new AnyPieceMessage();
|
||||
briefing = new BriefingMessage();
|
||||
ceremonyMessage = new CeremonyMessage();
|
||||
die = new DieMessage(6, new ArrayList<>());
|
||||
die = new DieMessage(6);
|
||||
diceAgain = new DiceAgainMessage();
|
||||
diceNow = new DiceNowMessage();
|
||||
endOfTurn = new EndOfTurnMessage();
|
||||
lobbyAccept = new LobbyAcceptMessage();
|
||||
lobbyDeny = new LobbyDenyMessage();
|
||||
lobbyPlayerJoin = new LobbyPlayerJoinMessage(from,name);
|
||||
lobbyPlayerJoin = new LobbyPlayerJoinedMessage(from,name);
|
||||
lobbyPlayerLeave = new LobbyPlayerLeaveMessage(from, color);
|
||||
moveMessage = new MoveMessage("www",false, 20);//Todo
|
||||
noTurn = new NoTurnMessage();
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
import pp.mdga.server.ServerGameLogic;
|
||||
import pp.mdga.server.ServerSender;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* this test-class tests the testcases T035-T058
|
||||
*/
|
||||
@@ -57,50 +59,59 @@ public void send(int id, ServerMessage message) {
|
||||
public void broadcast(ServerMessage message) {
|
||||
|
||||
}
|
||||
},game);
|
||||
}, game);
|
||||
|
||||
//declare player-Client here
|
||||
playerClient = new Player(nameClient);
|
||||
clientColor = Color.ARMY;
|
||||
game.addPlayer(2,playerClient);
|
||||
game.addPlayer(2, playerClient);
|
||||
|
||||
//declare pieces of client here
|
||||
pieceClient0 = new Piece(clientColor,PieceState.ACTIVE,3);
|
||||
pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,4);
|
||||
pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,5);
|
||||
pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,6);
|
||||
pieceClient0 = game.getBoard().getPlayerData().get(clientColor).getPieces()[0];
|
||||
pieceClient1 = game.getBoard().getPlayerData().get(clientColor).getPieces()[1];
|
||||
pieceClient2 = game.getBoard().getPlayerData().get(clientColor).getPieces()[2];
|
||||
pieceClient3 = game.getBoard().getPlayerData().get(clientColor).getPieces()[3];
|
||||
|
||||
//clear waiting-area of Client
|
||||
for (int i = 0; i < 4; i++) {
|
||||
game.getBoard().getPlayerData().get(clientColor).removePieceFromWaitingArea();
|
||||
}
|
||||
|
||||
//declare player-host here
|
||||
playerHost = new Player(nameHost);
|
||||
hostColor = Color.NAVY;
|
||||
game.addPlayer(1,playerHost);
|
||||
game.addPlayer(1, playerHost);
|
||||
|
||||
//declare pieces of host here
|
||||
pieceHost0 = new Piece(hostColor,PieceState.ACTIVE,7);
|
||||
pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,8);
|
||||
pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,9);
|
||||
pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,10);
|
||||
pieceHost0 = game.getBoard().getPlayerData().get(hostColor).getPieces()[0];
|
||||
pieceHost1 = game.getBoard().getPlayerData().get(hostColor).getPieces()[1];
|
||||
pieceHost2 = game.getBoard().getPlayerData().get(hostColor).getPieces()[2];
|
||||
pieceHost3 = game.getBoard().getPlayerData().get(hostColor).getPieces()[3];
|
||||
|
||||
//clear waiting-area of Client
|
||||
for (int i = 0; i < 4; i++) {
|
||||
game.getBoard().getPlayerData().get(hostColor).removePieceFromWaitingArea();
|
||||
}
|
||||
|
||||
//set the Client-pieces here
|
||||
game.getBoard().setPieceOnBoard(25,pieceClient0); //for UC 02, 03.01, 14,4
|
||||
game.getBoard().setPieceOnBoard(); //TODo set piece in Home at 2 slot for UC 18,12,13,11
|
||||
game.getBoard().setPieceOnBoard(19,pieceClient2); //for UC 13, 15
|
||||
game.getBoard().setPieceOnBoard();
|
||||
game.getBoard().setPieceOnBoard(25, pieceClient0); //for UC 02, 03.01, 14,4
|
||||
game.getBoard().getPlayerData().get(clientColor).setPieceInHome(1, pieceClient1); //set piece in Home at 2 slot for UC 18,12,13,11
|
||||
game.getBoard().setPieceOnBoard(19, pieceClient2); //for UC 13, 15
|
||||
game.getBoard().setPieceOnBoard(); //todo
|
||||
|
||||
//set the host-pieces here
|
||||
game.getBoard().setPieceOnBoard(28,pieceHost0); //for UC 02,14 ,15, 03.01,4
|
||||
game.getBoard().setPieceOnBoard(18,pieceHost1); //for UC 1, 10, 17, 16
|
||||
game.getBoard().setPieceOnBoard();//Todo set in home fur uc 5
|
||||
game.getBoard().setPieceOnBoard(0,pieceHost3); //for uc 9
|
||||
|
||||
game.getBoard().setPieceOnBoard(28, pieceHost0); //for UC 02,14 ,15, 03.01,4
|
||||
game.getBoard().setPieceOnBoard(18, pieceHost1); //for UC 1, 10, 17, 16
|
||||
game.getBoard().getPlayerData().get(hostColor).addWaitingPiece(pieceClient2); //set in waitingArea fur uc 5
|
||||
game.getBoard().setPieceOnBoard(0, pieceHost3); //for uc 9
|
||||
|
||||
//declare messages here
|
||||
//declare messages here todo
|
||||
|
||||
//send the serverGameTurn
|
||||
//send the serverGameTurn in todo
|
||||
|
||||
//set the active color
|
||||
//set the active color todo necessary?
|
||||
game.setActiveColor(clientColor);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +122,16 @@ public void broadcast(ServerMessage message) {
|
||||
*/
|
||||
@Test
|
||||
public void testMove() {
|
||||
// TODO: Implement test logic for when a piece can't move
|
||||
// TODO:
|
||||
//sets the active Player to host
|
||||
game.setActiveColor(hostColor);
|
||||
|
||||
//sets the die-class
|
||||
|
||||
//sends the move-message
|
||||
|
||||
//tests if the piece has moved in the right direction
|
||||
assertTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,6 +231,19 @@ public void testCantLeaveStartingField() {
|
||||
@Test
|
||||
public void testReachBonusField() {
|
||||
// TODO: Implement test logic for when a piece reaches a bonus field
|
||||
//sets the active Player to Host
|
||||
|
||||
//sets the dice-seed to 4
|
||||
|
||||
//sets the pile
|
||||
|
||||
//sends the requestDice-Message
|
||||
|
||||
// requestMOve of hostPiece3
|
||||
|
||||
//tests the position of hostPiece3
|
||||
|
||||
//tests if the player has received a bonusCard
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,6 +255,21 @@ public void testReachBonusField() {
|
||||
@Test
|
||||
public void testNoPowerCards() {
|
||||
// TODO: Implement test logic for when there are no power cards available
|
||||
//sets the active Player to Host
|
||||
|
||||
//sets the dice-seed to 4
|
||||
|
||||
//sets the pile empty
|
||||
|
||||
//sets the discard pile empty
|
||||
|
||||
//sends the requestDice-Message
|
||||
|
||||
// requestMOve of hostPiece3
|
||||
|
||||
//tests the position of hostPiece3
|
||||
|
||||
//tests if the player has received no a bonusCard
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +280,22 @@ public void testNoPowerCards() {
|
||||
*/
|
||||
@Test
|
||||
public void testShufflePile() {
|
||||
// TODO: Implement test logic for shuffling the pile of power cards
|
||||
//TODO
|
||||
//sets the active Player to Host
|
||||
|
||||
//sets the dice-seed to 4
|
||||
|
||||
//sets the pile empty
|
||||
|
||||
//sets the discard pile not empty
|
||||
|
||||
//sends the requestDice-Message
|
||||
|
||||
// requestMOve of hostPiece3
|
||||
|
||||
//tests the position of hostPiece3
|
||||
|
||||
//tests if the player has received no a bonusCard
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,6 +307,15 @@ public void testShufflePile() {
|
||||
@Test
|
||||
public void testEnterHouse() {
|
||||
// TODO: Implement test logic for entering the house area
|
||||
//sets the active Player to Client
|
||||
|
||||
//sets the dice-seed to 1
|
||||
|
||||
//send requestDice-Message
|
||||
|
||||
//sends requestMoveMessage with clientPiece 02
|
||||
|
||||
//tests, if the piece is in the first slot of the home
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,6 +349,15 @@ public void testActiveHomePiece() {
|
||||
@Test
|
||||
public void testCantJumpOverFigureInHouse() {
|
||||
// TODO: Implement test logic to prevent jumping over another piece in the house
|
||||
//sets the active Player to Client
|
||||
|
||||
//sets the dice-seed to 1
|
||||
|
||||
//send requestDice-Message
|
||||
|
||||
//sends requestMoveMessage with clientPiece 02
|
||||
|
||||
//tests, if the piece is in the first slot of the home
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,6 +380,17 @@ public void testActiveHomePieceBlocked() {
|
||||
@Test
|
||||
public void testOnStartingFieldWithShield() {
|
||||
// TODO: Implement test logic for a piece on the starting field with a shield
|
||||
//sets the color to host
|
||||
|
||||
//sets the dice-seed to 2
|
||||
|
||||
//sets the shield of hostPiece1 true
|
||||
|
||||
//sends the requestDice-message
|
||||
|
||||
//sends the moveMessage
|
||||
|
||||
//tests the position of the hostPiece1 and that shield is suppressed
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,5 +446,14 @@ public void testLoseShield() {
|
||||
@Test
|
||||
public void testFinishedPiece() {
|
||||
// TODO: Implement test logic for a piece that has finished the game
|
||||
//sets the active color to client
|
||||
|
||||
//set the dice-class seed to 2
|
||||
|
||||
//sends the requestDie-Message
|
||||
|
||||
//sends the requestMove-Message
|
||||
|
||||
//tests if the Piece is in the final position and is marked as home-finished
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.server.*;
|
||||
import pp.mdga.server.automaton.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import pp.mdga.server.automaton.game.*;
|
||||
import pp.mdga.server.automaton.game.turn.*;
|
||||
import pp.mdga.server.automaton.game.turn.choosepiece.*;
|
||||
import pp.mdga.server.automaton.game.turn.rolldice.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -34,7 +36,7 @@ public class ServerStateTest {
|
||||
private DeselectTSKMessage deselectTSK;
|
||||
private DisconnectedMessage disconnected;
|
||||
private ForceContinueGameMessage forceContinueGame;
|
||||
private JoinServerMessage joinServer;
|
||||
private JoinedLobbyMessage joinServer;
|
||||
private LeaveGameMessage leaveGame;
|
||||
private LobbyNotReadyMessage lobbyNotReady;
|
||||
private LobbyReadyMessage lobbyReady;
|
||||
@@ -124,7 +126,7 @@ public void broadcast(ServerMessage message) {
|
||||
deselectTSK = new DeselectTSKMessage(playerClientColor);
|
||||
disconnected = new DisconnectedMessage();
|
||||
forceContinueGame = new ForceContinueGameMessage();
|
||||
joinServer = new JoinServerMessage();
|
||||
joinServer = new JoinedLobbyMessage();
|
||||
leaveGame = new LeaveGameMessage();
|
||||
lobbyNotReady = new LobbyNotReadyMessage();
|
||||
lobbyReady = new LobbyReadyMessage();
|
||||
|
||||
Reference in New Issue
Block a user