Package games.war.behaviors

Examples of games.war.behaviors.Cheating


        dk.reset();
        dk.shuffle();
        timer = WarTimer.getInstance();

        CheatingBehavior player1 = new NotCheating();
        CheatingBehavior player2 = new Cheating();
        playerCon = new PlayerController(player1, player2);
        timer.addObserver(playerCon);
    }
View Full Code Here


     * Makes sure the initialization works correctly
     */
    @Test
    public void testInit()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        assertEquals(2, pc.players.size());
        assertTrue(pc.players.get(0) != null);
        assertTrue(pc.players.get(1) != null);
        assertEquals(null, pc.player1Card);
View Full Code Here

     * Makes sure the normal draw works as it should
     */
    @Test
    public void testNormalDraw()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        pc.playerNormalDraw(0);
        assertTrue(pc.player1Card != null);
        assertTrue(pc.player2Card == null);

View Full Code Here

     * makes sure cards can be placed correctly
     */
    @Test
    public void testPlaceCard()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());
        String properOutPlayer1 = "0-c";
        String properOutPlayer2 = "0-c \t\t1-c\n";

        pc.placeCard(0, new Card(0, 'c'));
        assertEquals(properOutPlayer1, outContent.toString());
View Full Code Here

     * Makes sure null cards can be placed
     */
    @Test
    public void testPlaceCardWithNullCard()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());
        String properOutPlayer1 = "";
        String properOutPlayer2 = " \t\t\n";

        pc.placeCard(0, null);
        assertEquals(properOutPlayer1, outContent.toString());
View Full Code Here

     * Makes sure cards can be killed and that the header is output correctly
     */
    @Test
    public void testKillCards()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        String dashes = "--------------------------------------------------------------------------------";
        String properOut = "\n" + dashes + "\nPlayer One\tPlayer Two\nCards: 26\tCards: 26\n";
        pc.killCardsOnScreen();
        assertEquals(properOut, outContent.toString());
View Full Code Here

     * Makes sure winners can be found
     */
    @Test
    public void testFindWinner()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        pc.player1Card = new Card(10, 'c');
        pc.player2Card = new Card(1, 'c');

        assertEquals(0, pc.findWinner());
View Full Code Here

     * Makes sure the players can go to war
     */
    @Test
    public void testGoToWar()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());
        assertTrue(pc.goToWar(pc.players.get(0)) != null);
    }
View Full Code Here

     * Makes sure checkForWar works as it should
     */
    @Test
    public void testCheckForWar()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        assertTrue(pc.checkForWar(new Card(10, 'c'), new Card(10, 'd')));
        assertFalse(pc.checkForWar(new Card(10, 'c'), new Card(9, 'd')));
    }
View Full Code Here

     * Makes sure checkForWar works will null cards
     */
    @Test
    public void testCheckForWarNullCards()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        assertFalse(pc.checkForWar(null, new Card(10, 'd')));
        assertFalse(pc.checkForWar(new Card(10, 'c'), null));
        assertFalse(pc.checkForWar(null, null));
    }
View Full Code Here

TOP

Related Classes of games.war.behaviors.Cheating

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.