added comments
This commit is contained in:
@@ -72,7 +72,7 @@ public class ClientStateTest {
|
|||||||
private EndOfTurnMessage endOfTurn;
|
private EndOfTurnMessage endOfTurn;
|
||||||
private LobbyAcceptMessage lobbyAccept;
|
private LobbyAcceptMessage lobbyAccept;
|
||||||
private LobbyDenyMessage lobbyDeny;
|
private LobbyDenyMessage lobbyDeny;
|
||||||
private LobbyPlayerJoinMessage lobbyPlayerJoin;
|
private LobbyPlayerJoinedMessage lobbyPlayerJoin;
|
||||||
private LobbyPlayerLeaveMessage lobbyPlayerLeave;
|
private LobbyPlayerLeaveMessage lobbyPlayerLeave;
|
||||||
private MoveMessage moveMessage;
|
private MoveMessage moveMessage;
|
||||||
private NoTurnMessage noTurn;
|
private NoTurnMessage noTurn;
|
||||||
@@ -130,13 +130,13 @@ public void send(ClientMessage msg) {
|
|||||||
anyPiece = new AnyPieceMessage();
|
anyPiece = new AnyPieceMessage();
|
||||||
briefing = new BriefingMessage();
|
briefing = new BriefingMessage();
|
||||||
ceremonyMessage = new CeremonyMessage();
|
ceremonyMessage = new CeremonyMessage();
|
||||||
die = new DieMessage(6, new ArrayList<>());
|
die = new DieMessage(6);
|
||||||
diceAgain = new DiceAgainMessage();
|
diceAgain = new DiceAgainMessage();
|
||||||
diceNow = new DiceNowMessage();
|
diceNow = new DiceNowMessage();
|
||||||
endOfTurn = new EndOfTurnMessage();
|
endOfTurn = new EndOfTurnMessage();
|
||||||
lobbyAccept = new LobbyAcceptMessage();
|
lobbyAccept = new LobbyAcceptMessage();
|
||||||
lobbyDeny = new LobbyDenyMessage();
|
lobbyDeny = new LobbyDenyMessage();
|
||||||
lobbyPlayerJoin = new LobbyPlayerJoinMessage(from,name);
|
lobbyPlayerJoin = new LobbyPlayerJoinedMessage(from,name);
|
||||||
lobbyPlayerLeave = new LobbyPlayerLeaveMessage(from, color);
|
lobbyPlayerLeave = new LobbyPlayerLeaveMessage(from, color);
|
||||||
moveMessage = new MoveMessage("www",false, 20);//Todo
|
moveMessage = new MoveMessage("www",false, 20);//Todo
|
||||||
noTurn = new NoTurnMessage();
|
noTurn = new NoTurnMessage();
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.ServerSender;
|
import pp.mdga.server.ServerSender;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this test-class tests the testcases T035-T058
|
* this test-class tests the testcases T035-T058
|
||||||
*/
|
*/
|
||||||
@@ -65,10 +67,15 @@ public void broadcast(ServerMessage message) {
|
|||||||
game.addPlayer(2, playerClient);
|
game.addPlayer(2, playerClient);
|
||||||
|
|
||||||
//declare pieces of client here
|
//declare pieces of client here
|
||||||
pieceClient0 = new Piece(clientColor,PieceState.ACTIVE,3);
|
pieceClient0 = game.getBoard().getPlayerData().get(clientColor).getPieces()[0];
|
||||||
pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,4);
|
pieceClient1 = game.getBoard().getPlayerData().get(clientColor).getPieces()[1];
|
||||||
pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,5);
|
pieceClient2 = game.getBoard().getPlayerData().get(clientColor).getPieces()[2];
|
||||||
pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,6);
|
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
|
//declare player-host here
|
||||||
playerHost = new Player(nameHost);
|
playerHost = new Player(nameHost);
|
||||||
@@ -76,31 +83,35 @@ public void broadcast(ServerMessage message) {
|
|||||||
game.addPlayer(1, playerHost);
|
game.addPlayer(1, playerHost);
|
||||||
|
|
||||||
//declare pieces of host here
|
//declare pieces of host here
|
||||||
pieceHost0 = new Piece(hostColor,PieceState.ACTIVE,7);
|
pieceHost0 = game.getBoard().getPlayerData().get(hostColor).getPieces()[0];
|
||||||
pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,8);
|
pieceHost1 = game.getBoard().getPlayerData().get(hostColor).getPieces()[1];
|
||||||
pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,9);
|
pieceHost2 = game.getBoard().getPlayerData().get(hostColor).getPieces()[2];
|
||||||
pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,10);
|
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
|
//set the Client-pieces here
|
||||||
game.getBoard().setPieceOnBoard(25, pieceClient0); //for UC 02, 03.01, 14,4
|
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().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(19, pieceClient2); //for UC 13, 15
|
||||||
game.getBoard().setPieceOnBoard();
|
game.getBoard().setPieceOnBoard(); //todo
|
||||||
|
|
||||||
//set the host-pieces here
|
//set the host-pieces here
|
||||||
|
|
||||||
game.getBoard().setPieceOnBoard(28, pieceHost0); //for UC 02,14 ,15, 03.01,4
|
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(18, pieceHost1); //for UC 1, 10, 17, 16
|
||||||
game.getBoard().setPieceOnBoard();//Todo set in home fur uc 5
|
game.getBoard().getPlayerData().get(hostColor).addWaitingPiece(pieceClient2); //set in waitingArea fur uc 5
|
||||||
game.getBoard().setPieceOnBoard(0, pieceHost3); //for uc 9
|
game.getBoard().setPieceOnBoard(0, pieceHost3); //for uc 9
|
||||||
|
|
||||||
|
//declare messages here todo
|
||||||
|
|
||||||
//declare messages here
|
//send the serverGameTurn in todo
|
||||||
|
|
||||||
//send the serverGameTurn
|
//set the active color todo necessary?
|
||||||
|
|
||||||
//set the active color
|
|
||||||
game.setActiveColor(clientColor);
|
game.setActiveColor(clientColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +122,16 @@ public void broadcast(ServerMessage message) {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMove() {
|
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
|
@Test
|
||||||
public void testReachBonusField() {
|
public void testReachBonusField() {
|
||||||
// TODO: Implement test logic for when a piece reaches a bonus field
|
// 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
|
@Test
|
||||||
public void testNoPowerCards() {
|
public void testNoPowerCards() {
|
||||||
// TODO: Implement test logic for when there are no power cards available
|
// 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
|
@Test
|
||||||
public void testShufflePile() {
|
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
|
@Test
|
||||||
public void testEnterHouse() {
|
public void testEnterHouse() {
|
||||||
// TODO: Implement test logic for entering the house area
|
// 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
|
@Test
|
||||||
public void testCantJumpOverFigureInHouse() {
|
public void testCantJumpOverFigureInHouse() {
|
||||||
// TODO: Implement test logic to prevent jumping over another piece in the house
|
// 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
|
@Test
|
||||||
public void testOnStartingFieldWithShield() {
|
public void testOnStartingFieldWithShield() {
|
||||||
// TODO: Implement test logic for a piece on the starting field with a shield
|
// 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
|
@Test
|
||||||
public void testFinishedPiece() {
|
public void testFinishedPiece() {
|
||||||
// TODO: Implement test logic for a piece that has finished the game
|
// 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.message.client.*;
|
||||||
import pp.mdga.server.*;
|
import pp.mdga.server.*;
|
||||||
import pp.mdga.server.automaton.*;
|
import pp.mdga.server.automaton.*;
|
||||||
|
import pp.mdga.server.automaton.game.*;
|
||||||
import java.util.ArrayList;
|
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.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ public class ServerStateTest {
|
|||||||
private DeselectTSKMessage deselectTSK;
|
private DeselectTSKMessage deselectTSK;
|
||||||
private DisconnectedMessage disconnected;
|
private DisconnectedMessage disconnected;
|
||||||
private ForceContinueGameMessage forceContinueGame;
|
private ForceContinueGameMessage forceContinueGame;
|
||||||
private JoinServerMessage joinServer;
|
private JoinedLobbyMessage joinServer;
|
||||||
private LeaveGameMessage leaveGame;
|
private LeaveGameMessage leaveGame;
|
||||||
private LobbyNotReadyMessage lobbyNotReady;
|
private LobbyNotReadyMessage lobbyNotReady;
|
||||||
private LobbyReadyMessage lobbyReady;
|
private LobbyReadyMessage lobbyReady;
|
||||||
@@ -124,7 +126,7 @@ public void broadcast(ServerMessage message) {
|
|||||||
deselectTSK = new DeselectTSKMessage(playerClientColor);
|
deselectTSK = new DeselectTSKMessage(playerClientColor);
|
||||||
disconnected = new DisconnectedMessage();
|
disconnected = new DisconnectedMessage();
|
||||||
forceContinueGame = new ForceContinueGameMessage();
|
forceContinueGame = new ForceContinueGameMessage();
|
||||||
joinServer = new JoinServerMessage();
|
joinServer = new JoinedLobbyMessage();
|
||||||
leaveGame = new LeaveGameMessage();
|
leaveGame = new LeaveGameMessage();
|
||||||
lobbyNotReady = new LobbyNotReadyMessage();
|
lobbyNotReady = new LobbyNotReadyMessage();
|
||||||
lobbyReady = new LobbyReadyMessage();
|
lobbyReady = new LobbyReadyMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user