summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 01:51:49 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 01:51:49 +0200
commit2446671f7ab832cca5e0412ae0301b901e0b69d5 (patch)
tree00dc3910836e3e84162ba8dfd997d013fad40b12 /test/jrummikub
parent102299d0ffc15a08167f6eab8b9813c2f7dcda3b (diff)
downloadJRummikub-2446671f7ab832cca5e0412ae0301b901e0b69d5.tar
JRummikub-2446671f7ab832cca5e0412ae0301b901e0b69d5.zip
Cleaned up RoundControl tests
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@260 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/control/RoundControlTest.java40
-rw-r--r--test/jrummikub/model/RoundStateTest.java2
2 files changed, 21 insertions, 21 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java
index 550c2cb..b170581 100644
--- a/test/jrummikub/control/RoundControlTest.java
+++ b/test/jrummikub/control/RoundControlTest.java
@@ -11,18 +11,20 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import java.awt.Color;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import jrummikub.model.GameSettings;
import jrummikub.model.Hand;
import jrummikub.model.IHand;
import jrummikub.model.ITable;
-import jrummikub.model.MockGameSettings;
import jrummikub.model.MockRoundState;
import jrummikub.model.MockTable;
+import jrummikub.model.PlayerSettings;
import jrummikub.model.Position;
import jrummikub.model.RoundState;
import jrummikub.model.Stone;
@@ -42,6 +44,10 @@ public class RoundControlTest {
private MockRoundState testRoundState;
private RoundControl testRound;
private MockTable testTable;
+
+ private GameSettings gameSettings;
+ private RoundState roundState;
+ private RoundControl roundControl;
/**
* For each test create a round control initialized by a mock model and view
@@ -56,6 +62,18 @@ public class RoundControlTest {
testTable = new MockTable();
testTable.sets.add(testRoundState.table.sets.get(0));
testRoundState.table.clonedTable = testTable;
+
+ gameSettings = new GameSettings();
+
+ gameSettings.getPlayerList().add(new PlayerSettings("Ida", Color.RED));
+ gameSettings.getPlayerList().add(
+ new PlayerSettings("Matthias", Color.YELLOW));
+ gameSettings.getPlayerList().add(
+ new PlayerSettings("Jannis", Color.GREEN));
+ gameSettings.getPlayerList().add(
+ new PlayerSettings("Bennet", Color.BLACK));
+ roundState = new RoundState(gameSettings);
+ roundControl = new RoundControl(roundState, view);
}
private void checkCorrectlyDealed() {
@@ -104,9 +122,6 @@ public class RoundControlTest {
/** Threshold=30 */
@Test
public void laidOutValidTooFew() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
@@ -137,9 +152,6 @@ public class RoundControlTest {
/** Threshold=30 */
@Test
public void laidOutInvalidEnough() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
@@ -184,9 +196,6 @@ public class RoundControlTest {
/** Threshold=30 */
@Test
public void laidOutTooFewChangedTable() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
@@ -254,9 +263,6 @@ public class RoundControlTest {
/** Threshold=30 */
@Test
public void laidOutEnoughChangedTable() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
@@ -323,12 +329,9 @@ public class RoundControlTest {
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 7, hand.getSize());
}
-
+
@Test
public void laidOutJustChangedTable() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
@@ -389,9 +392,6 @@ public class RoundControlTest {
/** Threshold=30 */
@Test
public void laidOutValid() {
- MockGameSettings gameSettings = new MockGameSettings();
- RoundState roundState = new RoundState(gameSettings);
- RoundControl roundControl = new RoundControl(roundState, view);
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
diff --git a/test/jrummikub/model/RoundStateTest.java b/test/jrummikub/model/RoundStateTest.java
index c71cead..bfbe857 100644
--- a/test/jrummikub/model/RoundStateTest.java
+++ b/test/jrummikub/model/RoundStateTest.java
@@ -11,7 +11,7 @@ import org.junit.Test;
* Test class for {@link RoundState}
*/
public class RoundStateTest {
- private IGameSettings settings = new GameSettings();
+ private GameSettings settings = new GameSettings();
private IRoundState testRound;
/** */