Exemplo n.º 1
0
 @Test
 public void testCard() {
   // if card was created (is not null)
   assertNotNull(card);
   // if card was created with proper rank
   assertEquals(rank3, card.getRank());
   // if cards suit is different than another suit
   assertNotEquals(suitD, card.getSuit());
   // if after change suits match
   card.setSuit(suitD);
   assertEquals(suitD, card.getSuit());
   // if card's String representation is as expected
   assertEquals("3♦", card.toString());
 }
Exemplo n.º 2
0
  @Test
  public void testNumCards() {

    List<Card> deck = makeDeck();
    Card tmpCard;

    Hand aHand =
        new Hand(
            1
                + " "
                + deck.remove(0)
                + " "
                + deck.remove(0)
                + " "
                + deck.remove(0)
                + " "
                + deck.remove(0)
                + " "
                + deck.remove(0));

    assertTrue(aHand.isComplete());

    try {
      tmpCard = deck.remove(0);
      aHand.addCard(tmpCard.getRank(), tmpCard.getSuit());
    } catch (Exception e) {
      fail("hand exception");
    }
  }
Exemplo n.º 3
0
 @Test
 public void testContructorGetSuit() {
   System.out.println("card() and getSuit()");
   Card.Suit expSuit = Card.Suit.CLUB;
   Card instance = new Card(expSuit, Card.Rank.TWO);
   Card.Suit suitResult = instance.getSuit();
   assertEquals(expSuit, suitResult);
 }
Exemplo n.º 4
0
  @Test
  public void testInstantion() {
    Card card1 = new Card(Suit.HEART, "5");
    Card card2 = new Card(Suit.SPADE, "K");

    assertNotNull(card1);
    assertNotNull(card2);

    assertEquals(10, card2.getValue());
    assertEquals("HEART", card1.getSuit().toString());
    assertEquals("5", card1.getDescription());
  }
Exemplo n.º 5
0
 @Test
 public final void testGetSuit() {
   Assert.assertEquals(CardSuit.CLUBS, AC.getSuit());
   Assert.assertEquals(CardSuit.HEARTS, KH.getSuit());
   Assert.assertEquals(AC.getSuit(), AC2.getSuit());
   Assert.assertFalse(AC.getSuit().equals(KH.getSuit()));
 }