Included session 3 code
This commit is contained in:
0
PokerKata/test/session3/CardTest.java
Normal file → Executable file
0
PokerKata/test/session3/CardTest.java
Normal file → Executable file
0
PokerKata/test/session3/HighCardRuleTest.java
Normal file → Executable file
0
PokerKata/test/session3/HighCardRuleTest.java
Normal file → Executable file
0
PokerKata/test/session3/PairRuleTest.java
Normal file → Executable file
0
PokerKata/test/session3/PairRuleTest.java
Normal file → Executable file
0
PokerKata/test/session3/PlayerTest.java
Normal file → Executable file
0
PokerKata/test/session3/PlayerTest.java
Normal file → Executable file
0
PokerKata/test/session3/PokerGameComparatorTest.java
Normal file → Executable file
0
PokerKata/test/session3/PokerGameComparatorTest.java
Normal file → Executable file
99
PokerKata/test/session3/PokerGameTest.java
Normal file → Executable file
99
PokerKata/test/session3/PokerGameTest.java
Normal file → Executable file
@@ -6,63 +6,15 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PokerGameTest {
|
||||
<<<<<<< HEAD
|
||||
PokerGame myGame = new PokerGame();
|
||||
|
||||
@Test
|
||||
public void nothing_gives_0() throws Exception {
|
||||
String hand = "S2H3C4D5S7";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(0, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pair_gives_1() throws Exception {
|
||||
String hand = "S3H3C4D5S8";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(1, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void two_pairs_gives_2() throws Exception {
|
||||
String hand = "S3H3C9D5S5";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(2, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void three_of_a_kind_gives_3() throws Exception {
|
||||
String hand = "S8H8C8D3S4";
|
||||
=======
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void straight_gives_4() throws Exception {
|
||||
String hand = "K2S3H4R5R6";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(4, result);
|
||||
=======
|
||||
assertEquals("Green", winningPlayer.getPlayerName());
|
||||
}
|
||||
|
||||
@@ -75,59 +27,9 @@ public class PokerGameTest {
|
||||
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";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(5, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void full_house_gives_6() throws Exception {
|
||||
String hand = "S2K2R2H7S7";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(6, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void four_of_a_kind_gives_7() throws Exception {
|
||||
String hand = "S2K2R2H2S7";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(7, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void straight_flush_gives_8() throws Exception {
|
||||
String hand = "K2K3K4K5K6";
|
||||
|
||||
int result = myGame.getScore(hand);
|
||||
|
||||
assertEquals(8, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void royal_straight_flush_gives_9() throws Exception {
|
||||
String hand = "R10RKRDRKRE";
|
||||
|
||||
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");
|
||||
@@ -136,6 +38,5 @@ public class PokerGameTest {
|
||||
Player winningPlayer = game.calculateWinningPlayer(green, white);
|
||||
|
||||
assertEquals("White", winningPlayer.getPlayerName());
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
}
|
||||
|
||||
9
PokerKata/test/session3/TwoPairRuleTest.java
Normal file → Executable file
9
PokerKata/test/session3/TwoPairRuleTest.java
Normal file → Executable file
@@ -1,7 +1,8 @@
|
||||
package session3;
|
||||
|
||||
import src.session3.Player;
|
||||
import src.session3.TwoPairRule;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TwoPairRuleTest {
|
||||
|
||||
@@ -26,7 +27,7 @@ public class TwoPairRuleTest {
|
||||
assertEquals("Green", winningPlayer.getPlayerName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void first_pair_tie_second_pair_highest_wins() throws Exception {
|
||||
Player green = new Player("Green", "9S 9C 6D 6H AH");
|
||||
@@ -34,6 +35,6 @@ public class TwoPairRuleTest {
|
||||
|
||||
Player winningPlayer = TwoPairRule.compare(white, green);
|
||||
|
||||
assertEquals("Green", winningPlayer.getPlayerName());
|
||||
assertEquals("Green", winningPlayer.getPlayerName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user