added T016
This commit is contained in:
		@@ -761,6 +761,70 @@ public void testStatistics() {
 | 
			
		||||
    // UC-Game-12
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testRefillPowerCardDeck() {
 | 
			
		||||
        // TODO: Implement test logic for refilling the power card deck
 | 
			
		||||
        //tests if both player have no color and are not ready
 | 
			
		||||
        assertFalse(playerClient.isReady());
 | 
			
		||||
        assertFalse(playerHost.isReady());
 | 
			
		||||
        assertEquals(playerClient.getColor(), Color.NONE);
 | 
			
		||||
        assertEquals(playerHost.getColor(), Color.NONE);
 | 
			
		||||
 | 
			
		||||
        //send the selectTSK-message
 | 
			
		||||
        logic.received(new SelectTSKMessage(Color.CYBER), IDClient);
 | 
			
		||||
        logic.received(new SelectTSKMessage(Color.ARMY), IDHost);
 | 
			
		||||
 | 
			
		||||
        //sends and tests the readyMessage for the client
 | 
			
		||||
        logic.received(new LobbyReadyMessage(), IDClient);
 | 
			
		||||
        logic.received(new LobbyReadyMessage(), IDHost);
 | 
			
		||||
        assertTrue(playerClient.isReady());
 | 
			
		||||
        assertTrue(playerHost.isReady());
 | 
			
		||||
 | 
			
		||||
        //tests if the game has started after the determineStartPlayerState
 | 
			
		||||
        logic.received(new StartGameMessage(), IDHost);
 | 
			
		||||
        assertEquals(logic.getCurrentState(), logic.getGameState());
 | 
			
		||||
        assertEquals(logic.getGameState().getCurrentState(), logic.getGameState().getDetermineStartPlayerState());
 | 
			
		||||
 | 
			
		||||
        //roll the order
 | 
			
		||||
        game.setDie(new Die(4));
 | 
			
		||||
        logic.received(new RequestDieMessage(), IDHost);
 | 
			
		||||
        game.setDie(new Die(3));
 | 
			
		||||
        logic.received(new RequestDieMessage(), IDClient);
 | 
			
		||||
        logic.received(new AnimationEndMessage(), IDClient);
 | 
			
		||||
        logic.received(new AnimationEndMessage(), IDHost);
 | 
			
		||||
 | 
			
		||||
        //tests that the server is in the animation-state
 | 
			
		||||
        assertEquals(logic.getCurrentState(), logic.getGameState());
 | 
			
		||||
        assertEquals(logic.getGameState().getCurrentState(), logic.getGameState().getAnimationState());
 | 
			
		||||
 | 
			
		||||
        logic.received(new AnimationEndMessage(), IDClient);
 | 
			
		||||
        logic.received(new AnimationEndMessage(), IDHost);
 | 
			
		||||
 | 
			
		||||
        assertEquals(logic.getCurrentState(), logic.getGameState());
 | 
			
		||||
        assertEquals(logic.getGameState().getCurrentState(), logic.getGameState().getTurnState());
 | 
			
		||||
 | 
			
		||||
        //tests if the host is the active player
 | 
			
		||||
        assertEquals(game.getActiveColor(), playerHost.getColor());
 | 
			
		||||
 | 
			
		||||
        //hosts plays no power-card
 | 
			
		||||
        logic.received(new NoPowerCardMessage(), IDHost);
 | 
			
		||||
 | 
			
		||||
        game.setDie(new Die(4));
 | 
			
		||||
        game.setDiscardPile(game.getDrawPile());
 | 
			
		||||
        game.setDrawPile(new ArrayList<>());
 | 
			
		||||
 | 
			
		||||
        //tests if the draw-pile is empty
 | 
			
		||||
        assertTrue(game.getDrawPile().isEmpty());
 | 
			
		||||
 | 
			
		||||
        //simulates a roll and the move of a piece for the host
 | 
			
		||||
        logic.received(new RequestDieMessage(), IDHost);
 | 
			
		||||
        logic.received(new AnimationEndMessage(), IDHost);
 | 
			
		||||
        logic.received(new RequestMoveMessage(game.getBoard().getInfield()[playerHost.getStartNodeIndex()].getOccupant()), IDHost);
 | 
			
		||||
 | 
			
		||||
        //tests if the server is in movePiece
 | 
			
		||||
        assertEquals(logic.getGameState().getCurrentState(), logic.getGameState().getTurnState());
 | 
			
		||||
        assertEquals(logic.getGameState().getTurnState().getCurrentState(), logic.getGameState().getTurnState().getMovePieceState());
 | 
			
		||||
 | 
			
		||||
        //tests if the draw-pile is not empty, the discard pile is empty and the host-player has drawn a card
 | 
			
		||||
        assertFalse(game.getDrawPile().isEmpty());
 | 
			
		||||
        assertTrue(game.getDiscardPile().isEmpty());
 | 
			
		||||
        assertEquals(2, playerHost.getHandCards().size());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user