summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-04 21:37:30 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-04 21:37:30 +0200
commitd559e1707722a4cd04a70185520f31e94ff26b18 (patch)
tree90133ca6e5c6069b503e13cf1e63e653dd5c5ec0 /test/jrummikub/control
parent4ae29c76c2703bb7f36aee70aaf09c6bb7590464 (diff)
downloadJRummikub-d559e1707722a4cd04a70185520f31e94ff26b18.tar
JRummikub-d559e1707722a4cd04a70185520f31e94ff26b18.zip
Added startRound test to RoundControlTest
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@122 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/control')
-rw-r--r--test/jrummikub/control/RoundControlTest.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index c591563..bc0bb3d 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -4,23 +4,45 @@ import static org.junit.Assert.*;
import jrummikub.model.GameState;
import jrummikub.view.MockView;
+import org.junit.Before;
import org.junit.Test;
public class RoundControlTest {
+ private MockView view;
+ private GameState testGameState;
+ private RoundControl testRound;
- @Test
- public void testDeal() {
- MockView view = new MockView();
- GameState testGameState = new GameState();
- RoundControl testRound = new RoundControl(testGameState, view);
- testRound.deal();
+ @Before
+ public void setup() {
+ view = new MockView();
+ testGameState = new GameState();
+ testRound = new RoundControl(testGameState, view);
+ }
+
+ private void checkCorrectlyDealed() {
assertEquals(106 - testGameState.getPlayerCount() * 14, testGameState
.getGameHeap().getSize());
for (int i = 0; i < testGameState.getPlayerCount(); i++) {
assertEquals(14, testGameState.getPlayer(i).getHand().getSize());
}
}
-
-
+ @Test
+ public void testDeal() {
+ testRound.deal();
+ checkCorrectlyDealed();
+ }
+
+ @Test
+ public void testStartRound() {
+ testRound.startRound();
+ checkCorrectlyDealed();
+
+ assertNotNull(view.currentPlayerName);
+ assertNotNull(view.getTablePanel().leftPlayerName);
+ assertNotNull(view.getTablePanel().topPlayerName);
+ assertNotNull(view.getTablePanel().rightPlayerName);
+ assertTrue(view.displayStartTurnPanel);
+ assertFalse(view.startTurnEvent.listeners.isEmpty());
+ }
}