summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/control/RoundControlTest.java24
-rw-r--r--test/jrummikub/model/GameStateTest.java8
2 files changed, 28 insertions, 4 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
new file mode 100644
index 0000000..2e6a7d0
--- /dev/null
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -0,0 +1,24 @@
+package jrummikub.control;
+
+import static org.junit.Assert.*;
+import jrummikub.model.GameState;
+import jrummikub.view.MockView;
+
+import org.junit.Test;
+
+public class RoundControlTest {
+
+ @Test
+ public void testDeal() {
+ MockView view = new MockView();
+ GameState testGameState = new GameState();
+ RoundControl testRound = new RoundControl(testGameState, view);
+ testRound.deal();
+ assertEquals(106 - testGameState.getPlayerCount() * 14, testGameState
+ .getGameHeap().getSize());
+ for (int i = 0; i < testGameState.getPlayerCount(); i++) {
+ assertEquals(14, testGameState.getPlayer(i).getHand().getSize());
+ }
+ }
+
+}
diff --git a/test/jrummikub/model/GameStateTest.java b/test/jrummikub/model/GameStateTest.java
index 8887e78..a134231 100644
--- a/test/jrummikub/model/GameStateTest.java
+++ b/test/jrummikub/model/GameStateTest.java
@@ -18,13 +18,13 @@ public class GameStateTest {
@Test
public void nextActiveTest() {
// All there?
- assertEquals(4, testGame.players.size());
- assertSame(Color.red, testGame.activePlayer().getColor());
+ assertEquals(4, testGame.getPlayerCount());
+ assertSame(Color.red, testGame.getActivePlayer().getColor());
testGame.nextPlayer();
- assertSame(Color.yellow, testGame.activePlayer().getColor());
+ assertSame(Color.yellow, testGame.getActivePlayer().getColor());
testGame.nextPlayer();
testGame.nextPlayer();
testGame.nextPlayer();
- assertSame(Color.red, testGame.activePlayer().getColor());
+ assertSame(Color.red, testGame.getActivePlayer().getColor());
}
}