Merge from home

PokerGame.java
PokerGameTest.java
This commit is contained in:
2015-04-30 14:47:26 +02:00
15 changed files with 514 additions and 24 deletions

View File

@@ -1,20 +1,12 @@
/**
* PokerGame.java
*
* Course in Software Craftsmenship @ Högskolan Väst
* Poker game kata for testing TDD, Test Driven Development
*
* 2015-04-27
*/
package session3;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
public class PokerGameTest {
<<<<<<< HEAD
PokerGame myGame = new PokerGame();
@Test
@@ -47,9 +39,18 @@ public class PokerGameTest {
@Test
public void three_of_a_kind_gives_3() throws Exception {
String hand = "S8H8C8D3S4";
=======
int result = myGame.getScore(hand);
@Test
public void green_wins_with_highest_card() {
Player green = new Player("Green", "2S 3C 4D 7H AH");
Player white = new Player("White", "3S 4C 5D 6H KH");
PokerGame game = new PokerGame();
>>>>>>> origin/master
Player winningPlayer = game.calculateWinningPlayer(green, white);
<<<<<<< HEAD
assertEquals(3, result);
}
@@ -61,9 +62,24 @@ public class PokerGameTest {
int result = myGame.getScore(hand);
assertEquals(4, result);
=======
assertEquals("Green", winningPlayer.getPlayerName());
}
@Test
public void one_pair_beats_highest_card() throws Exception {
Player green = new Player("Green", "2S 3C 4D 7H AH");
Player white = new Player("White", "3S 3C 5D 6H KH");
PokerGame game = new PokerGame();
Player winningPlayer = game.calculateWinningPlayer(green, white);
assertEquals("White", winningPlayer.getPlayerName());
>>>>>>> origin/master
}
@Test
<<<<<<< HEAD
@Ignore
public void flush_gives_5() throws Exception {
String hand = "S2S6S7S8S9";
@@ -111,5 +127,15 @@ public class PokerGameTest {
int result = myGame.getScore(hand);
assertEquals(9, result);
=======
public void two_pair_beats_one_pair() throws Exception {
Player green = new Player("Green", "6S 6C 4D 7H AH");
Player white = new Player("White", "3S 3C 5D 5H KH");
PokerGame game = new PokerGame();
Player winningPlayer = game.calculateWinningPlayer(green, white);
assertEquals("White", winningPlayer.getPlayerName());
>>>>>>> origin/master
}
}
}