added som javadoc in the PieceTest-class

This commit is contained in:
Benjamin Feyer
2024-12-01 14:31:06 +01:00
parent d7b0ac92b8
commit 55ef5438d2

View File

@@ -62,22 +62,24 @@ public void broadcast(ServerMessage message) {
//declare player-Client here //declare player-Client here
playerClient = new Player(nameClient); playerClient = new Player(nameClient);
clientColor = Color.ARMY; clientColor = Color.ARMY;
game.addPlayer(2,playerClient);
//declare pieces of client here //declare pieces of client here
pieceClient0 = new Piece(clientColor,PieceState.ACTIVE,2); pieceClient0 = new Piece(clientColor,PieceState.ACTIVE,3);
pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,3); pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,4);
pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,4); pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,5);
pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,5); pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,6);
//declare player-host here //declare player-host here
playerHost = new Player(nameHost); playerHost = new Player(nameHost);
hostColor = Color.NAVY; hostColor = Color.NAVY;
game.addPlayer(1,playerHost);
//declare pieces of host here //declare pieces of host here
pieceHost0 = new Piece(hostColor,PieceState.ACTIVE,6); pieceHost0 = new Piece(hostColor,PieceState.ACTIVE,7);
pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,7); pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,8);
pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,8); pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,9);
pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,9); pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,10);
//set the Pieces here //set the Pieces here
@@ -86,133 +88,243 @@ public void broadcast(ServerMessage message) {
} }
// UC-Piece-01 /**
@Test * Tests the logic for when a piece can't move.
public void testMove() { * <p>
// TODO: Implement test logic for moving a piece * Use Case UC-Piece-02: Ensure that a piece cannot move if blocked by others.
} * </p>
*/
// UC-Piece-02
@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