public void testPokerPlayerCheck2Pair() { PokerPlayer testPlayer = new PokerPlayer(); // testing checkPair2 testPlayer.setPlayer("Player1 TwoHearts ThreeClubs TwoClubs ThreeSpades SixHearts"); testPlayer.sortHand(); assertEquals(2, testPlayer.checkPair2(3, -1, -1)); // non-pair testPlayer.setPlayer("Player1 TwoHearts ThreeDiamonds TwoClubs FourSpades SixHearts"); testPlayer.sortHand(); assertEquals(-1, testPlayer.checkPair2(2, -1, -1)); }
public void testPokerPlayerCheckThreeOAK() { PokerPlayer testPlayer = new PokerPlayer(); // testing checkThreeOAK() testPlayer.setPlayer("Player1 TwoHearts TwoDiamonds TwoClubs FourSpades SixHearts"); testPlayer.sortHand(); assertEquals(2, testPlayer.checkThreeOAK(-1)); // non-3OAK testPlayer.setPlayer("Player1 FiveHearts ThreeHearts NineHearts TwoHearts FourClubs"); testPlayer.sortHand(); assertEquals(-1, testPlayer.checkThreeOAK(-1)); }
@Test public void testPokerPlayerCheckStraight() { PokerPlayer testPlayer = new PokerPlayer(); // testing checkStraight() testPlayer.setPlayer("Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts"); testPlayer.sortHand(); assertEquals(6, testPlayer.checkStraight()); // non-straight testPlayer.setPlayer("Player1 FiveHearts ThreeHearts NineHearts TwoHearts FourClubs"); testPlayer.sortHand(); assertEquals(-1, testPlayer.checkStraight()); }
@Test public void testPokerPlayerSortHand() { PokerPlayer testPlayer = new PokerPlayer(); // Testing sortHand() testPlayer.setPlayer("Player1 FiveHearts ThreeHearts SixHearts TwoHearts FourHearts"); testPlayer.sortHand(); assertEquals( "Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts", testPlayer.toString()); }