Package belotetime.tests

Source Code of belotetime.tests.TestPlayer

package belotetime.tests;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;

import belotetime.application.game.Card;
import belotetime.application.game.Pack;
import belotetime.application.game.Player;

public class TestPlayer
{
  Player p;
  ArrayList<Card> listCards;
  Pack hand;
  Card c1, c2, c3;
 
  public TestPlayer()
  {
    p = new Player("Test");
    listCards = new ArrayList<>();
        c1 = new Card("Dame", "Coeur", 3);
        c2 = new Card("Roi", "Coeur", 4);
        c3 = new Card("As", "Pique", 11);
        c3.setTrump(true);
    listCards.add(c1);
        listCards.add(c2);
        listCards.add(c3);
    hand = new Pack(listCards);
    p.setHand(hand);
  }
  @Test
  public void testHasBelote()
  {
    assertFalse(p.hasBelote());
    c1.setTrump(true);
    assertFalse(p.hasBelote());
    c2.setTrump(true);
    assertTrue(p.getHand().getCards().get(0).getName().equals("Dame"));
    assertTrue(p.getHand().getCards().get(1).getName().equals("Roi"));
    assertTrue(p.getHand().getCards().get(0).equals(c1));
    assertTrue(c1.isTrump());
    assertTrue(p.getHand().getCards().get(1).isTrump());
    assertTrue(p.hasBelote());
  }

}
TOP

Related Classes of belotetime.tests.TestPlayer

TOP
Copyright © 2018 www.massapi.com. 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.