summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-06-17 22:12:41 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-06-17 22:12:41 +0200
commit47bf19036e049787fa7742f5ff72a08a0c9e887c (patch)
tree0858aef8cc91af311a1c8505d69411d116da83ba /test
parenta07e723242da4fbdd00cee2d86a46f4db70bc87a (diff)
downloadJRummikub-47bf19036e049787fa7742f5ff72a08a0c9e887c.tar
JRummikub-47bf19036e049787fa7742f5ff72a08a0c9e887c.zip
Use new AI for computer players
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@448 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test')
-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);