fixed PieceTest18
This commit is contained in:
@@ -327,7 +327,7 @@ public void testMove() {
|
|||||||
* Use Case UC-Piece-02: Ensure that a piece cannot move if blocked by others.
|
* Use Case UC-Piece-02: Ensure that a piece cannot move if blocked by others.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test (expected = RuntimeException.class)
|
||||||
public void testCantMove() {
|
public void testCantMove() {
|
||||||
//set active player to army
|
//set active player to army
|
||||||
game.setActiveColor(clientColor);
|
game.setActiveColor(clientColor);
|
||||||
@@ -349,6 +349,7 @@ public void testCantMove() {
|
|||||||
|
|
||||||
//send request Die-message
|
//send request Die-message
|
||||||
serverGameLogic.received(new RequestDieMessage(),IDClient);
|
serverGameLogic.received(new RequestDieMessage(),IDClient);
|
||||||
|
serverGameLogic.received(new AnimationEndMessage(),IDClient);
|
||||||
|
|
||||||
//send requestMove-Message
|
//send requestMove-Message
|
||||||
serverGameLogic.received(new RequestMoveMessage(pieceClient2),IDClient);
|
serverGameLogic.received(new RequestMoveMessage(pieceClient2),IDClient);
|
||||||
@@ -896,7 +897,7 @@ public void testOnlyEnterOwnHouse() {
|
|||||||
serverGameLogic.received(new RequestMoveMessage(pieceHost1),IDHost);
|
serverGameLogic.received(new RequestMoveMessage(pieceHost1),IDHost);
|
||||||
System.out.println(game.getBoard().getInfieldIndexOfPiece(pieceHost1));
|
System.out.println(game.getBoard().getInfieldIndexOfPiece(pieceHost1));
|
||||||
|
|
||||||
//tests if hostPiece1 is at idx 20 TODO false positive
|
//tests if hostPiece1 is at idx 20
|
||||||
assertTrue(game.getBoard().getInfield()[31].isOccupied());
|
assertTrue(game.getBoard().getInfield()[31].isOccupied());
|
||||||
assertEquals(game.getBoard().getInfield()[31].getOccupant(),pieceHost1);
|
assertEquals(game.getBoard().getInfield()[31].getOccupant(),pieceHost1);
|
||||||
}
|
}
|
||||||
@@ -1293,12 +1294,25 @@ public void testLoseShield() {
|
|||||||
public void testFinishedPiece() {
|
public void testFinishedPiece() {
|
||||||
//sets the active color to client
|
//sets the active color to client
|
||||||
game.setActiveColor(clientColor);
|
game.setActiveColor(clientColor);
|
||||||
|
playerClient.setHandCards(new ArrayList<>());
|
||||||
|
|
||||||
//sends the server in selectPiece
|
|
||||||
|
//sends the server in RollDicePiece
|
||||||
serverGameLogic.setCurrentState(gameState);
|
serverGameLogic.setCurrentState(gameState);
|
||||||
serverGameLogic.getGameState().setCurrentState(turnState);
|
serverGameLogic.getGameState().setCurrentState(turnState);
|
||||||
serverGameLogic.getGameState().getTurnState().setCurrentState(choosePieceState);
|
|
||||||
serverGameLogic.getGameState().getTurnState().getChoosePieceState().setCurrentState(selectPieceState);
|
//tests if the server is in firstRoll-state
|
||||||
|
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
||||||
|
assertEquals(gameState.getCurrentState(), turnState);
|
||||||
|
assertEquals(turnState.getCurrentState(),rollDiceState);
|
||||||
|
assertEquals(rollDiceState.getCurrentState(),firstRollState);
|
||||||
|
|
||||||
|
//set the dice to 2
|
||||||
|
game.setDie(die2);
|
||||||
|
|
||||||
|
//sends the requestDie-Message
|
||||||
|
serverGameLogic.received(new RequestDieMessage(),IDClient);
|
||||||
|
serverGameLogic.received(new AnimationEndMessage(),IDClient);
|
||||||
|
|
||||||
//tests if the server is in selectPieces
|
//tests if the server is in selectPieces
|
||||||
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
assertEquals(serverGameLogic.getCurrentState(),gameState);
|
||||||
@@ -1306,12 +1320,6 @@ public void testFinishedPiece() {
|
|||||||
assertEquals(turnState.getCurrentState(),choosePieceState);
|
assertEquals(turnState.getCurrentState(),choosePieceState);
|
||||||
assertEquals(choosePieceState.getCurrentState(),selectPieceState);
|
assertEquals(choosePieceState.getCurrentState(),selectPieceState);
|
||||||
|
|
||||||
//set the dice to 2
|
|
||||||
game.setDie(die2);
|
|
||||||
//sends the requestDie-Message
|
|
||||||
serverGameLogic.received(new RequestDieMessage(),IDClient);
|
|
||||||
serverGameLogic.received(new AnimationEndMessage(),IDClient);
|
|
||||||
|
|
||||||
//sends the requestMove-Message
|
//sends the requestMove-Message
|
||||||
serverGameLogic.received(new RequestMoveMessage(pieceClient1),IDClient);
|
serverGameLogic.received(new RequestMoveMessage(pieceClient1),IDClient);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user