More tests!

This commit is contained in:
neviyn 2017-01-14 19:13:51 +00:00
parent 85d5eeaae4
commit 8c1f842557

View File

@ -42,7 +42,7 @@ public class HandTest {
} }
@Test @Test
public void fiveOfAKind(){ public void fiveOfAKind() {
deck.addCard(new Card(Suit.CLUBS, Value.TEN)); deck.addCard(new Card(Suit.CLUBS, Value.TEN));
deck.addCard(new Card(Suit.SPADES, Value.TEN)); deck.addCard(new Card(Suit.SPADES, Value.TEN));
deck.addCard(new Card(Suit.HEARTS, Value.TEN)); deck.addCard(new Card(Suit.HEARTS, Value.TEN));
@ -52,10 +52,6 @@ public class HandTest {
assertEquals(Result.FIVE_OF_A_KIND, hand.checkForWin()); assertEquals(Result.FIVE_OF_A_KIND, hand.checkForWin());
} }
@Test
@Ignore
public void fiveOfAKindWithJoker(){}
@Test @Test
public void straightFlush() { public void straightFlush() {
deck.addCard(new Card(Suit.SPADES, Value.TWO)); deck.addCard(new Card(Suit.SPADES, Value.TWO));
@ -68,8 +64,29 @@ public class HandTest {
} }
@Test @Test
@Ignore public void straightFlushWithJoker() {
public void straightFlushWithJoker() {} deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.SPADES, Value.THREE));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.SPADES, Value.SIX));
Hand hand = new Hand(deck);
assertEquals(Result.STRAIGHT_FLUSH, hand.checkForWin());
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.SPADES, Value.THREE));
deck.addCard(new Card(Suit.SPADES, Value.FOUR));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.SPADES, Value.SIX));
hand.newRound();
assertEquals(Result.STRAIGHT_FLUSH, hand.checkForWin());
deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.SPADES, Value.THREE));
deck.addCard(new Card(Suit.SPADES, Value.FOUR));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
hand.newRound();
assertEquals(Result.STRAIGHT_FLUSH, hand.checkForWin());
}
@Test @Test
public void fourOfAKind() { public void fourOfAKind() {
@ -83,8 +100,15 @@ public class HandTest {
} }
@Test @Test
@Ignore public void fourOfAKindWithJoker() {
public void fourOfAKindWithJoker() {} deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.HEARTS, Value.TWO));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.CLUBS, Value.TWO));
deck.addCard(new Card(Suit.SPADES, Value.SIX));
Hand hand = new Hand(deck);
assertEquals(Result.FOUR_OF_A_KIND, hand.checkForWin());
}
@Test @Test
public void fullHouse() { public void fullHouse() {
@ -109,8 +133,15 @@ public class HandTest {
} }
@Test @Test
@Ignore public void flushWithJoker() {
public void flushWithJoker() {} deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.SPADES, Value.FOUR));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.SPADES, Value.NINE));
deck.addCard(new Card(Suit.SPADES, Value.KING));
Hand hand = new Hand(deck);
assertEquals(Result.FLUSH, hand.checkForWin());
}
@Test @Test
public void straight() { public void straight() {
@ -135,8 +166,29 @@ public class HandTest {
} }
@Test @Test
@Ignore public void straightWithJoker() {
public void straightWithJoker() {} deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.DIAMONDS, Value.THREE));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.CLUBS, Value.SIX));
Hand hand = new Hand(deck);
assertEquals(Result.STRAIGHT, hand.checkForWin());
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.DIAMONDS, Value.THREE));
deck.addCard(new Card(Suit.HEARTS, Value.FOUR));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.CLUBS, Value.SIX));
hand.newRound();
assertEquals(Result.STRAIGHT, hand.checkForWin());
deck.addCard(new Card(Suit.SPADES, Value.TWO));
deck.addCard(new Card(Suit.DIAMONDS, Value.THREE));
deck.addCard(new Card(Suit.HEARTS, Value.FOUR));
deck.addCard(new Card(Suit.SPADES, Value.FIVE));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
hand.newRound();
assertEquals(Result.STRAIGHT, hand.checkForWin());
}
@Test @Test
public void threeOfAKind() { public void threeOfAKind() {
@ -150,8 +202,15 @@ public class HandTest {
} }
@Test @Test
@Ignore public void threeOfAKindWithJoker() {
public void threeOfAKindWithJoker() {} deck.addCard(new Card(Suit.SPADES, Value.FOUR));
deck.addCard(new Card(Suit.HEARTS, Value.FOUR));
deck.addCard(new Card(Suit.JOKER, Value.JOKER));
deck.addCard(new Card(Suit.CLUBS, Value.THREE));
deck.addCard(new Card(Suit.SPADES, Value.ACE));
Hand hand = new Hand(deck);
assertEquals(Result.THREE_OF_A_KIND, hand.checkForWin());
}
@Test @Test
public void twoPair() { public void twoPair() {
@ -168,7 +227,7 @@ public class HandTest {
private Stack<Card> cards = new Stack<>(); private Stack<Card> cards = new Stack<>();
public void addCard(Card card){ public void addCard(Card card) {
cards.push(card); cards.push(card);
} }
@ -182,7 +241,7 @@ public class HandTest {
// FakeDeck has no base deck to reset to. // FakeDeck has no base deck to reset to.
} }
protected void clearDeck(){ protected void clearDeck() {
cards = new Stack<>(); cards = new Stack<>();
} }
} }