HandType.HIGH_CARD.getDescription()));
assertTrue(hand1.compareTo(hand2) == 0);
}
public void testPairHands() {
Hand hand1 = new Hand();
Hand hand2 = new Hand();
// test hand1>hand2
hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.CLUBS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
assertTrue(hand1.getShortDescription().equals(
HandType.PAIR.getDescription()));
assertTrue(hand2.getShortDescription().equals(
HandType.PAIR.getDescription()));
assertTrue(hand1.compareTo(hand2) == 1);
hand2 = new Hand();
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.CLUBS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
assertTrue(hand2.getShortDescription().equals(
HandType.PAIR.getDescription()));
assertTrue(hand1.compareTo(hand2) == 1);
// test hand2>hand1
hand2 = new Hand();
hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.HEARTS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.CLUBS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
assertTrue(hand2.getShortDescription().equals(
HandType.PAIR.getDescription()));
assertTrue(hand1.compareTo(hand2) == -1);
// test hand2==hand1
hand2 = new Hand();
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
assertTrue(hand2.getShortDescription().equals(
HandType.PAIR.getDescription()));
assertTrue(hand1.compareTo(hand2) == 0);
}