Пример #1
0
 public void testInit() {
   CardDeck cardDeck = new CardDeck();
   cardDeck.init(
       new LinkedList<Card>(
           Arrays.asList(
               new Card[] {
                 cards[1], cards[3], cards[5], cards[7],
               })));
   assertEquals(4, cardDeck.countBacks());
   assertEquals(0, cardDeck.countFaces());
   assertNull(cardDeck.getCurrentCard());
   // ==========
 }
Пример #2
0
 public void testTakeCard() {
   CardDeck cardDeck = new CardDeck();
   cardDeck.init(
       new LinkedList<Card>(
           Arrays.asList(
               new Card[] {
                 cards[1], cards[3], cards[5], cards[7],
               })));
   assertNull(cardDeck.takeCard());
   cardDeck.drawCard();
   assertEquals(cards[7], cardDeck.takeCard());
   cardDeck.drawCard();
   assertEquals(cards[5], cardDeck.takeCard());
   cardDeck.drawCard();
   assertEquals(cards[3], cardDeck.takeCard());
   cardDeck.drawCard();
   assertEquals(cards[1], cardDeck.takeCard());
   assertNull(cardDeck.takeCard());
   cardDeck.drawCard();
   assertNull(cardDeck.takeCard());
 }