diff --git a/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java b/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java index 112eb140..0a264b00 100644 --- a/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java +++ b/Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java @@ -62,22 +62,24 @@ public void broadcast(ServerMessage message) { //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,2); - pieceClient1 = new Piece(clientColor,PieceState.ACTIVE,3); - pieceClient2 = new Piece(clientColor,PieceState.ACTIVE,4); - pieceClient3 = new Piece(clientColor,PieceState.ACTIVE,5); + 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,6); - pieceHost1 = new Piece(hostColor,PieceState.ACTIVE,7); - pieceHost2 = new Piece(hostColor,PieceState.ACTIVE,8); - pieceHost3 = new Piece(hostColor,PieceState.ACTIVE,9); + 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 Pieces here @@ -86,133 +88,243 @@ public void broadcast(ServerMessage message) { } - // UC-Piece-01 - @Test - public void testMove() { - // TODO: Implement test logic for moving a piece - } - - // UC-Piece-02 + /** + * Tests the logic for when a piece can't move. + *
+ * Use Case UC-Piece-02: Ensure that a piece cannot move if blocked by others. + *
+ */ @Test public void testCantMove() { // TODO: Implement test logic for when a piece can't move } - // UC-Piece-03 + /** + * Tests the logic for when no possible moves are available. + *+ * Use Case UC-Piece-03: Check game behavior when a player has no valid moves. + *
+ */ @Test public void testNoPossibleMove() { // TODO: Implement test logic for when no possible moves are available } + /** + * Tests the logic for throwing a piece off the board. + *+ * Use Case UC-Piece-03: Verify conditions under which a piece can be thrown off. + *
+ */ @Test public void testThrow() { // TODO: Implement test logic for throwing a piece off the board } - // UC-Piece-04 + /** + * Tests the logic for when a piece gets thrown. + *+ * Use Case UC-Piece-04: Confirm that a thrown piece is removed from play. + *
+ */ @Test public void testGetThrown() { // TODO: Implement test logic for when a piece gets thrown } - // UC-Piece-05 + /** + * Tests the logic for a piece leaving the waiting area. + *+ * Use Case UC-Piece-05: Ensure a piece can transition from waiting to active play. + *
+ */ @Test public void testLeaveWaitingArea() { // 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. + *+ * Use Case UC-Piece-06: Verify conditions requiring a piece to leave its starting position. + *
+ */ @Test public void testMustLeaveStartingField() { // 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. + *+ * Use Case UC-Piece-07: Check scenarios where a piece can stay on its starting field. + *
+ */ @Test public void testDontHaveToLeaveStartingField() { // 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. + *+ * Use Case UC-Piece-08: Verify conditions preventing a piece from leaving its starting field. + *
+ */ @Test public void testCantLeaveStartingField() { // 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. + *+ * Use Case UC-Piece-09: Verify the benefits applied when landing on a bonus field. + *
+ */ @Test public void testReachBonusField() { // TODO: Implement test logic for when a piece reaches a bonus field } + /** + * Tests the logic for when there are no power cards available. + *+ * Use Case UC-Piece-09: Ensure the game handles the situation with no available power cards. + *
+ */ @Test public void testNoPowerCards() { // TODO: Implement test logic for when there are no power cards available } + /** + * Tests the logic for shuffling the pile of power cards. + *+ * Use Case UC-Piece-09: Confirm that the power card deck can be shuffled correctly. + *
+ */ @Test public void testShufflePile() { // TODO: Implement test logic for shuffling the pile of power cards } - // UC-Piece-10 + /** + * Tests the logic for entering the house area. + *+ * Use Case UC-Piece-10: Verify that a piece can enter the house area according to the rules. + *
+ */ @Test public void testEnterHouse() { // TODO: Implement test logic for entering the house area } + /** + * Tests the logic to ensure a piece can only enter its own house. + *+ * Use Case UC-Piece-10: Check that a piece can only enter its designated house. + *
+ */ @Test public void testOnlyEnterOwnHouse() { // 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. + *+ * Use Case UC-Piece-11: Confirm that a piece can be activated correctly in the home area. + *
+ */ @Test public void testActiveHomePiece() { // TODO: Implement test logic for activating a piece in the home area } + /** + * Tests the logic to prevent jumping over another piece in the house. + *+ * Use Case UC-Piece-11: Ensure that a piece cannot jump over another piece in the house area. + *
+ */ @Test public void testCantJumpOverFigureInHouse() { // 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. + *+ * Use Case UC-Piece-12: Verify that an active piece cannot move if blocked by another piece. + *
+ */ @Test public void testActiveHomePieceBlocked() { // 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. + *+ * Use Case UC-Piece-13: Ensure that a piece with a shield behaves correctly on the starting field. + *
+ */ @Test public void testOnStartingFieldWithShield() { // 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. + *+ * Use Case UC-Piece-14: Verify that a piece with a shield cannot be thrown by opponents. + *
+ */ @Test public void testThrowFigureWithShield() { // 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. + *+ * Use Case UC-Piece-15: Confirm that a player can use a swap power-up to exchange positions. + *
+ */ @Test public void testUseSwap() { // TODO: Implement test logic for using a swap power-up } - // UC-Piece-15 + /** + * Tests the logic for using a shield power-up. + *+ * Use Case UC-Piece-16: Ensure that a player can activate a shield power-up correctly. + *
+ */ @Test public void testUseShield() { // TODO: Implement test logic for using a shield power-up } - // UC-Piece-16 + /** + * Tests the logic for when a piece loses its shield. + *+ * Use Case UC-Piece-17: Verify that the game correctly updates the status when a piece loses its shield. + *
+ */ @Test public void testLoseShield() { // 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. + *+ * Use Case UC-Piece-18: Confirm that the game recognizes a piece that has completed its journey. + *
+ */ @Test public void testFinishedPiece() { // TODO: Implement test logic for a piece that has finished the game