merge tests into development #25
File diff suppressed because it is too large
Load Diff
@@ -2,144 +2,355 @@
|
|||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import pp.mdga.message.server.ServerMessage;
|
||||||
|
import pp.mdga.server.ServerGameLogic;
|
||||||
|
import pp.mdga.server.ServerSender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this test-class tests the testcases T035-T058
|
* this test-class tests the testcases T035-T058
|
||||||
*/
|
*/
|
||||||
public class PieceTest {
|
public class PieceTest {
|
||||||
|
|
||||||
|
//declare game here
|
||||||
|
private Game game;
|
||||||
|
|
||||||
|
//declare server here
|
||||||
|
private ServerGameLogic serverGameLogic;
|
||||||
|
|
||||||
|
//declare player-Client here
|
||||||
|
private Player playerClient;
|
||||||
|
private String nameClient = "Client";
|
||||||
|
private Color clientColor;
|
||||||
|
|
||||||
|
//declare pieces of client here
|
||||||
|
private Piece pieceClient0;
|
||||||
|
private Piece pieceClient1;
|
||||||
|
private Piece pieceClient2;
|
||||||
|
private Piece pieceClient3;
|
||||||
|
|
||||||
|
//declare player-host here
|
||||||
|
private Player playerHost;
|
||||||
|
private String nameHost = "Host";
|
||||||
|
private Color hostColor;
|
||||||
|
|
||||||
|
//declare pieces of host here
|
||||||
|
private Piece pieceHost0;
|
||||||
|
private Piece pieceHost1;
|
||||||
|
private Piece pieceHost2;
|
||||||
|
private Piece pieceHost3;
|
||||||
|
|
||||||
|
//declare messages here
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void Setup() {
|
public void Setup() {
|
||||||
|
//initialize game here
|
||||||
|
game = new Game();
|
||||||
|
|
||||||
|
//initialize server here
|
||||||
|
serverGameLogic = new ServerGameLogic(new ServerSender() {
|
||||||
|
@Override
|
||||||
|
public void send(int id, ServerMessage message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void broadcast(ServerMessage message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
},game);
|
||||||
|
|
||||||
|
//declare player-Client here
|
||||||
|
playerClient = new Player(nameClient);
|
||||||
|
clientColor = Color.ARMY;
|
||||||
|
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);
|
||||||
|
|
||||||
|
//declare player-host here
|
||||||
|
playerHost = new Player(nameHost);
|
||||||
|
hostColor = Color.NAVY;
|
||||||
|
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);
|
||||||
|
|
||||||
|
//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();
|
||||||
|
|
||||||
|
//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
|
||||||
|
|
||||||
|
|
||||||
|
//declare messages here
|
||||||
|
|
||||||
|
//send the serverGameTurn
|
||||||
|
|
||||||
|
//set the active color
|
||||||
|
game.setActiveColor(clientColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-01
|
/**
|
||||||
|
* Tests the logic for when a piece moves.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-01: Ensure that a piece moves in the right direction
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMove() {
|
public void testMove() {
|
||||||
// TODO: Implement test logic for moving a piece
|
// TODO: Implement test logic for when a piece can't move
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-02
|
/**
|
||||||
|
* Tests the logic for when a piece can't move.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-02: Ensure that a piece cannot move if blocked by others.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCantMove() {
|
public void testCantMove() {
|
||||||
// TODO: Implement test logic for when a piece can't move
|
// TODO: Implement test logic for when a piece can't move
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-03
|
/**
|
||||||
|
* Tests the logic for when no possible moves are available.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-03: Check game behavior when a player has no valid moves.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNoPossibleMove() {
|
public void testNoPossibleMove() {
|
||||||
// TODO: Implement test logic for when no possible moves are available
|
// TODO: Implement test logic for when no possible moves are available
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic for throwing a piece off the board.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-03: Verify conditions under which a piece can be thrown off.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testThrow() {
|
public void testThrow() {
|
||||||
// TODO: Implement test logic for throwing a piece off the board
|
// TODO: Implement test logic for throwing a piece off the board
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-04
|
/**
|
||||||
|
* Tests the logic for when a piece gets thrown.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-04: Confirm that a thrown piece is removed from play.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetThrown() {
|
public void testGetThrown() {
|
||||||
// TODO: Implement test logic for when a piece gets thrown
|
// TODO: Implement test logic for when a piece gets thrown
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-05
|
/**
|
||||||
|
* Tests the logic for a piece leaving the waiting area.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-05: Ensure a piece can transition from waiting to active play.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLeaveWaitingArea() {
|
public void testLeaveWaitingArea() {
|
||||||
// TODO: Implement test logic for a piece leaving the waiting area
|
// TODO: Implement test logic for a piece leaving the waiting area
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-06
|
/**
|
||||||
|
* Tests the logic for a piece that must leave the starting field.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-06: Verify conditions requiring a piece to leave its starting position.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMustLeaveStartingField() {
|
public void testMustLeaveStartingField() {
|
||||||
// TODO: Implement test logic for a piece that must leave the starting field
|
// TODO: Implement test logic for a piece that must leave the starting field
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-07
|
/**
|
||||||
|
* Tests the logic for when a piece doesn't have to leave the starting field.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-07: Check scenarios where a piece can stay on its starting field.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDontHaveToLeaveStartingField() {
|
public void testDontHaveToLeaveStartingField() {
|
||||||
// TODO: Implement test logic for when a piece doesn't have to leave the starting field
|
// TODO: Implement test logic for when a piece doesn't have to leave the starting field
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-08
|
/**
|
||||||
|
* Tests the logic for when a piece can't leave the starting field.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-08: Verify conditions preventing a piece from leaving its starting field.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCantLeaveStartingField() {
|
public void testCantLeaveStartingField() {
|
||||||
// TODO: Implement test logic for when a piece can't leave the starting field
|
// TODO: Implement test logic for when a piece can't leave the starting field
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-09
|
/**
|
||||||
|
* Tests the logic for when a piece reaches a bonus field.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-09: Verify the benefits applied when landing on a bonus field.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic for when there are no power cards available.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-09: Ensure the game handles the situation with no available power cards.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic for shuffling the pile of power cards.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-09: Confirm that the power card deck can be shuffled correctly.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testShufflePile() {
|
public void testShufflePile() {
|
||||||
// TODO: Implement test logic for shuffling the pile of power cards
|
// TODO: Implement test logic for shuffling the pile of power cards
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-10
|
/**
|
||||||
|
* Tests the logic for entering the house area.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-10: Verify that a piece can enter the house area according to the rules.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic to ensure a piece can only enter its own house.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-10: Check that a piece can only enter its designated house.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testOnlyEnterOwnHouse() {
|
public void testOnlyEnterOwnHouse() {
|
||||||
// TODO: Implement test logic to ensure a piece can only enter its own house
|
// TODO: Implement test logic to ensure a piece can only enter its own house
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-11
|
/**
|
||||||
|
* Tests the logic for activating a piece in the home area.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-11: Confirm that a piece can be activated correctly in the home area.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testActiveHomePiece() {
|
public void testActiveHomePiece() {
|
||||||
// TODO: Implement test logic for activating a piece in the home area
|
// TODO: Implement test logic for activating a piece in the home area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic to prevent jumping over another piece in the house.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-11: Ensure that a piece cannot jump over another piece in the house area.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-12
|
/**
|
||||||
|
* Tests the logic for when an active home piece is blocked.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-12: Verify that an active piece cannot move if blocked by another piece.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testActiveHomePieceBlocked() {
|
public void testActiveHomePieceBlocked() {
|
||||||
// TODO: Implement test logic for when an active home piece is blocked
|
// TODO: Implement test logic for when an active home piece is blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the logic for a piece on the starting field with a shield.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-13: Ensure that a piece with a shield behaves correctly on the starting field.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-13
|
/**
|
||||||
|
* Tests the logic for attempting to throw a figure with a shield.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-14: Verify that a piece with a shield cannot be thrown by opponents.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testThrowFigureWithShield() {
|
public void testThrowFigureWithShield() {
|
||||||
// TODO: Implement test logic for attempting to throw a figure with a shield
|
// TODO: Implement test logic for attempting to throw a figure with a shield
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-14
|
/**
|
||||||
|
* Tests the logic for using a swap power-up.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-15: Confirm that a player can use a swap power-up to exchange positions.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUseSwap() {
|
public void testUseSwap() {
|
||||||
// TODO: Implement test logic for using a swap power-up
|
// TODO: Implement test logic for using a swap power-up
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-15
|
/**
|
||||||
|
* Tests the logic for using a shield power-up.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-16: Ensure that a player can activate a shield power-up correctly.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUseShield() {
|
public void testUseShield() {
|
||||||
// TODO: Implement test logic for using a shield power-up
|
// TODO: Implement test logic for using a shield power-up
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-16
|
/**
|
||||||
|
* Tests the logic for when a piece loses its shield.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-17: Verify that the game correctly updates the status when a piece loses its shield.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoseShield() {
|
public void testLoseShield() {
|
||||||
// TODO: Implement test logic for when a piece loses its shield
|
// TODO: Implement test logic for when a piece loses its shield
|
||||||
}
|
}
|
||||||
|
|
||||||
// UC-Piece-17
|
/**
|
||||||
|
* Tests the logic for a piece that has finished the game.
|
||||||
|
* <p>
|
||||||
|
* Use Case UC-Piece-18: Confirm that the game recognizes a piece that has completed its journey.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
@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
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user