@Test public void testHasManyOfAKind() throws Exception { Hand hand = new Hand("2C 3C 4C 5C AS"); assertNull(calc.checkManyOfAKind(hand, 3)); hand = new Hand("2C 3C 2H 5C 2S"); HandStrength strength = calc.checkManyOfAKind(hand, 3); assertEquals(THREE_OF_A_KIND, strength.getHandType()); assertEquals(Rank.TWO, calc.checkManyOfAKind(hand, 3).getHighestRank()); assertEquals(2, strength.getKickerCards().size()); assertEquals(FIVE, strength.getKickerCards().get(0).getRank()); assertEquals(THREE, strength.getKickerCards().get(1).getRank()); assertEquals(5, strength.getCards().size()); hand = new Hand("2C 2C 2H 5C 2S"); assertEquals(THREE_OF_A_KIND, calc.checkManyOfAKind(hand, 3).getHandType()); assertEquals(Rank.TWO, calc.checkManyOfAKind(hand, 3).getHighestRank()); hand = new Hand("2C 2C 2H 5C 2S"); assertEquals(THREE_OF_A_KIND, calc.checkManyOfAKind(hand, 3).getHandType()); assertEquals(Rank.TWO, calc.checkManyOfAKind(hand, 3).getHighestRank()); hand = new Hand("2C 2C 2H AC AS AH"); assertEquals(THREE_OF_A_KIND, calc.checkManyOfAKind(hand, 3).getHandType()); assertEquals(Rank.ACE, calc.checkManyOfAKind(hand, 3).getHighestRank()); }
@Test public void testQuads() throws Exception { Hand hand = new Hand("2C 2H 5D 2H 2C"); HandStrength strength = calc.checkManyOfAKind(hand, 4); assertEquals(FOUR_OF_A_KIND, strength.getHandType()); assertEquals(TWO, strength.getHighestRank()); }
@Test public void testHasManyOfAKindOrder() throws Exception { Hand hand = new Hand("2C 3C 2C JC AS"); HandStrength strength = calc.checkManyOfAKind(hand, 2); assertEquals(PAIR, strength.getHandType()); assertEquals(new Card("2C"), strength.getCards().get(0)); assertEquals(new Card("2C"), strength.getCards().get(1)); assertEquals(new Card("AS"), strength.getCards().get(2)); assertEquals(new Card("JC"), strength.getCards().get(3)); assertEquals(new Card("3C"), strength.getCards().get(4)); }
@Test public void testOnePair() throws Exception { Hand hand = new Hand("2C 2H 5D JH 4C"); HandStrength strength = calc.checkManyOfAKind(hand, 2); assertEquals(PAIR, strength.getHandType()); assertEquals(TWO, strength.getHighestRank()); assertNull(strength.getSecondRank()); // Verify kicker cards assertEquals(3, strength.getKickerCards().size()); assertEquals(JACK, strength.getKickerCards().get(0).getRank()); assertEquals(FIVE, strength.getKickerCards().get(1).getRank()); assertEquals(FOUR, strength.getKickerCards().get(2).getRank()); }