refactored testing
This commit is contained in:
parent
ad3ec29962
commit
2638ca09b6
Binary file not shown.
Binary file not shown.
BIN
bin/test/cards/CardTest.class
Normal file
BIN
bin/test/cards/CardTest.class
Normal file
Binary file not shown.
BIN
bin/test/cards/RankTest.class
Normal file
BIN
bin/test/cards/RankTest.class
Normal file
Binary file not shown.
BIN
bin/test/cards/SuitTest.class
Normal file
BIN
bin/test/cards/SuitTest.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/MauMauDeckTest.class
Normal file
BIN
bin/test/cards/maumau/MauMauDeckTest.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/CardHandlerTest.class
Normal file
BIN
bin/test/cards/maumau/model/CardHandlerTest.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau1Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau1Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau2Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau2Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau3Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau3Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau4Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau4Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau5Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau5Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau6Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau6Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau7Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau7Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau8Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau8Test.class
Normal file
Binary file not shown.
BIN
bin/test/cards/maumau/model/MauMau9Test.class
Normal file
BIN
bin/test/cards/maumau/model/MauMau9Test.class
Normal file
Binary file not shown.
@ -30,16 +30,16 @@ public enum Suit {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case HEARTS:
|
case HEARTS:
|
||||||
return "♥";
|
return "♥︎";
|
||||||
|
|
||||||
case DIAMONDS:
|
case DIAMONDS:
|
||||||
return "♦";
|
return "♦︎";
|
||||||
|
|
||||||
case CLUBS:
|
case CLUBS:
|
||||||
return "♣";
|
return "♣︎";
|
||||||
|
|
||||||
case SPADES:
|
case SPADES:
|
||||||
return "♠";
|
return "♠︎";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
@ -73,7 +73,7 @@ public class CardHandler {
|
|||||||
* Deals cards to all players.
|
* Deals cards to all players.
|
||||||
* @throws Exception when there are not enough cards to satisfy starting conditions
|
* @throws Exception when there are not enough cards to satisfy starting conditions
|
||||||
*/
|
*/
|
||||||
void dealCards() throws Exception {
|
public void dealCards() throws Exception {
|
||||||
|
|
||||||
// get List of players
|
// get List of players
|
||||||
List<Player> players = game.getPlayers();
|
List<Player> players = game.getPlayers();
|
||||||
@ -119,7 +119,7 @@ public class CardHandler {
|
|||||||
*
|
*
|
||||||
* @return The top card of the discard pile.
|
* @return The top card of the discard pile.
|
||||||
*/
|
*/
|
||||||
Card top() {
|
public Card top() {
|
||||||
return discardPile.getFirst();
|
return discardPile.getFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package cards;
|
package test.cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import cards.Card;
|
||||||
|
import cards.Rank;
|
||||||
|
import cards.Suit;
|
||||||
|
|
||||||
import static cards.Rank.THREE;
|
import static cards.Rank.THREE;
|
||||||
import static cards.Rank.TWO;
|
import static cards.Rank.TWO;
|
||||||
import static cards.Suit.HEARTS;
|
import static cards.Suit.HEARTS;
|
@ -1,4 +1,4 @@
|
|||||||
package cards;
|
package test.cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cards;
|
package test.cards;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau;
|
package test.cards.maumau;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.MauMauDeck;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,11 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -35,7 +38,12 @@ public class CardHandlerTest {
|
|||||||
final Player chantal = game.addPlayer("Chantal");
|
final Player chantal = game.addPlayer("Chantal");
|
||||||
assertTrue(jacqueline.getCards().isEmpty());
|
assertTrue(jacqueline.getCards().isEmpty());
|
||||||
assertTrue(chantal.getCards().isEmpty());
|
assertTrue(chantal.getCards().isEmpty());
|
||||||
game.getCardHandler().dealCards();
|
try {
|
||||||
|
game.getCardHandler().dealCards();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString());
|
assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString());
|
||||||
assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString());
|
assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString());
|
||||||
assertEquals(c(ACE, HEARTS), game.getCardHandler().top());
|
assertEquals(c(ACE, HEARTS), game.getCardHandler().top());
|
@ -1,8 +1,11 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,8 +1,10 @@
|
|||||||
package cards.maumau.model;
|
package test.cards.maumau.model;
|
||||||
|
|
||||||
import cards.Card;
|
import cards.Card;
|
||||||
import cards.Rank;
|
import cards.Rank;
|
||||||
import cards.Suit;
|
import cards.Suit;
|
||||||
|
import cards.maumau.model.MauMau;
|
||||||
|
import cards.maumau.model.Player;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
Loading…
Reference in New Issue
Block a user