Make a blackjack game, play against the computer-dealer.

PlayerTest.java 894B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package rocks.zipcode;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import java.util.List;
  6. import static org.junit.Assert.*;
  7. public class PlayerTest {
  8. @Before
  9. public void setUp() throws Exception {
  10. }
  11. @After
  12. public void tearDown() throws Exception {
  13. }
  14. @Test
  15. public void addCard() {
  16. }
  17. @Test
  18. public void handScore() {
  19. }
  20. @Test
  21. public void clearHand() {
  22. }
  23. @Test
  24. public void testPlayer1() {
  25. Player player1 = new Player();
  26. List<Cards> deck = Cards.newDeck();
  27. Cards c1 = deck.get(0);
  28. Cards c2 = deck.get(16);
  29. player1.addCard(c1);
  30. player1.addCard(c2);
  31. int score = player1.handScore();
  32. int cardSum = c1.rank().getRankpoints() + c2.rank().getRankpoints();
  33. player1.printHand();
  34. assertEquals(cardSum, score);
  35. }
  36. }