summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-18 17:01:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-18 17:01:11 +0200
commite76977652d55463b98f847ce261926f0d9d7c0de (patch)
tree44798d441592c22a694da990fdf5d9333946562a /test
parentb5397d5aa7f01d557a469ca0d70f3b33e1fe2c60 (diff)
downloadJRummikub-e76977652d55463b98f847ce261926f0d9d7c0de.tar
JRummikub-e76977652d55463b98f847ce261926f0d9d7c0de.zip
RoundControl: Create players from player settings list from game settings
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@253 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-rw-r--r--test/jrummikub/model/RoundStateTest.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/jrummikub/model/RoundStateTest.java b/test/jrummikub/model/RoundStateTest.java
index de98090..bfbe857 100644
--- a/test/jrummikub/model/RoundStateTest.java
+++ b/test/jrummikub/model/RoundStateTest.java
@@ -6,30 +6,38 @@ import java.awt.Color;
import org.junit.Before;
import org.junit.Test;
-/**
+
+/**
* Test class for {@link RoundState}
*/
public class RoundStateTest {
- private IRoundState testGame;
+ private GameSettings settings = new GameSettings();
+ private IRoundState testRound;
/** */
@Before
- public void createGame() {
- testGame = new RoundState(new GameSettings());
+ public void createRound() {
+ settings.getPlayerList().add(new PlayerSettings("Player 1", Color.RED));
+ settings.getPlayerList().add(new PlayerSettings("Player 2", Color.YELLOW));
+ settings.getPlayerList().add(new PlayerSettings("Player 3", Color.BLUE));
+
+ testRound = new RoundState(settings);
}
/** */
@Test
public void nextActiveTest() {
// All there?
- assertEquals(4, testGame.getPlayerCount());
- assertSame(Color.red, testGame.getActivePlayer().getPlayerSettings().getColor());
- testGame.nextPlayer();
- assertSame(Color.yellow, testGame.getActivePlayer().getPlayerSettings().getColor());
- testGame.nextPlayer();
- testGame.nextPlayer();
- testGame.nextPlayer();
- assertSame(Color.red, testGame.getActivePlayer().getPlayerSettings().getColor());
+ assertEquals(settings.getPlayerList().size(), testRound.getPlayerCount());
+ assertSame(Color.RED, testRound.getActivePlayer().getPlayerSettings()
+ .getColor());
+ testRound.nextPlayer();
+ assertSame(Color.YELLOW, testRound.getActivePlayer().getPlayerSettings()
+ .getColor());
+ testRound.nextPlayer();
+ testRound.nextPlayer();
+ assertSame(Color.RED, testRound.getActivePlayer().getPlayerSettings()
+ .getColor());
}
-
+
}