summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/control/turn/AIControlTest.java (renamed from test/jrummikub/control/turn/BaseAIControlTest.java)19
1 files changed, 7 insertions, 12 deletions
diff --git a/test/jrummikub/control/turn/BaseAIControlTest.java b/test/jrummikub/control/turn/AIControlTest.java
index 51b1f1f..6f7bf6f 100644
--- a/test/jrummikub/control/turn/BaseAIControlTest.java
+++ b/test/jrummikub/control/turn/AIControlTest.java
@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Test;
/** */
-public class BaseAIControlTest {
+public class AIControlTest {
ITurnControl aiControl;
GameSettings gameSettings;
@@ -38,6 +38,7 @@ public class BaseAIControlTest {
@Before
public void setUp() {
aiControl = TurnControlFactory.getFactory(Type.COMPUTER).create();
+ ((AIControl)aiControl).useBackgroundThread = false;
gameSettings = new GameSettings();
playerSettings = new PlayerSettings("ROBOT_01", Color.GRAY);
player = new Player(playerSettings);
@@ -74,14 +75,12 @@ public class BaseAIControlTest {
* @throws InterruptedException
*/
@Test(timeout = 10000)
- public void testTurnZeroRedealing() throws InterruptedException {
+ public void testTurnZeroNoRedealing() throws InterruptedException {
aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
player.getLaidOut(), TurnMode.MAY_REDEAL), gameSettings, view);
aiControl.startTurn();
- while (!redealt) {
- Thread.sleep(100);
- }
- assertFalse(turnEnded);
+ assertTrue(turnEnded);
+ assertFalse(redealt);
assertEquals(table.getSize(), 0);
}
@@ -95,9 +94,7 @@ public class BaseAIControlTest {
player.getLaidOut(), TurnMode.INSPECT_ONLY),
gameSettings, view);
aiControl.startTurn();
- while (!turnEnded) {
- Thread.sleep(100);
- }
+ assertTrue(turnEnded);
assertFalse(redealt);
assertEquals(table.getSize(), 0);
}
@@ -110,9 +107,7 @@ public class BaseAIControlTest {
aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
player.getLaidOut(), TurnMode.NORMAL_TURN), gameSettings, view);
aiControl.startTurn();
- while (!turnEnded) {
- Thread.sleep(100);
- }
+ assertTrue(turnEnded);
assertFalse(redealt);
assertEquals(table.getSize(), 1);
assertEquals(player.getHand().getSize(), 0);