@Test public void testPokerPlayerSetnGetCard() { PokerPlayer testPlayer = new PokerPlayer(); // Testing setCardAtI() and getcard() testPlayer.setCardAtI(0, "FourClubs"); assertEquals("FourClubs", testPlayer.getCard(0).toString()); }
// ---------------------------Tests for // PokerPlayers--------------------------------------------------- @Test public void testPokerPlayerSetnGetID() { PokerPlayer testPlayer = new PokerPlayer(); // Testing GET and Set Methods for a Players // ID testPlayer.setID("player1"); assertEquals("player1", testPlayer.getID()); }
@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()); }
@Test public void testPokerPlayertoString() { PokerPlayer testPlayer = new PokerPlayer(); testPlayer.setPlayer("Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts"); // Testing PokerPlayer toString() function assertEquals( "Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts", testPlayer.toString()); }
@Test public void testPokerPlayerSetPlayer() { PokerPlayer testPlayer = new PokerPlayer(); // Testing setPlayer() // extracts id and card info from string testPlayer.setPlayer("Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts"); assertEquals("Player1", testPlayer.getID()); assertEquals("TwoHearts", testPlayer.getCard(0).toString()); assertEquals("SixHearts", testPlayer.getCard(4).toString()); }
public void testPokerPlayerGetHandValue() { PokerPlayer testPlayer = new PokerPlayer(); // Tests for getHandValue() testPlayer.setPlayer("Player1 TwoHearts ThreeHearts FourHearts FiveHearts SixHearts"); // checking for a flush testPlayer.getHandValue(); assertEquals(6, testPlayer.handValue.flush); // checking for a straight assertEquals(6, testPlayer.handValue.straight); // checking the function has read a straight flush assertEquals(8, testPlayer.handValue.handVal); // the rest should be -1 (not present) assertEquals(-1, testPlayer.handValue.fourOAK); assertEquals(-1, testPlayer.handValue.threeOAK); assertEquals(-1, testPlayer.handValue.pair2); assertEquals(-1, testPlayer.handValue.pair1); }
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()); }