summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control/turn
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub/control/turn')
-rw-r--r--test/jrummikub/control/turn/AIControlTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/jrummikub/control/turn/AIControlTest.java b/test/jrummikub/control/turn/AIControlTest.java
index dca6466..f2c567e 100644
--- a/test/jrummikub/control/turn/AIControlTest.java
+++ b/test/jrummikub/control/turn/AIControlTest.java
@@ -1,8 +1,12 @@
package jrummikub.control.turn;
-import static org.junit.Assert.*;
+import static jrummikub.model.StoneColor.RED;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.awt.Color;
+import java.util.Arrays;
import jrummikub.control.RoundControl;
import jrummikub.model.GameSettings;
@@ -15,6 +19,7 @@ import jrummikub.model.Position;
import jrummikub.model.RoundState;
import jrummikub.model.Stone;
import jrummikub.model.StoneColor;
+import jrummikub.model.StoneSet;
import jrummikub.util.IListener;
import jrummikub.util.IListener2;
import jrummikub.view.MockView;
@@ -115,4 +120,21 @@ public class AIControlTest {
assertEquals(1, roundState.getTable().getSize());
assertEquals(0, roundState.getActivePlayer().getHand().getSize());
}
+
+ @Test
+ public void testWithStonesOnTable() {
+ roundState.getActivePlayer().setLaidOut(true);
+ roundState.getTable().drop(new StoneSet(Arrays.asList(new Stone(1, RED), new Stone(2, RED), new Stone(3, RED))), new Position(0,0));
+ IHand hand = roundState.getActivePlayer().getHand();
+ hand.drop(new Stone(4, RED), new Position(0,0));
+ hand.drop(new Stone(7, RED), new Position(0,0));
+ aiControl.setup(new ITurnControl.TurnInfo(roundState,
+ TurnMode.NORMAL_TURN, false), gameSettings, view);
+ aiControl.startTurn();
+ assertTrue(turnEnded);
+ assertFalse(redealt);
+ assertEquals(2, roundState.getTable().getSize());
+ assertEquals(1, roundState.getActivePlayer().getHand().getSize());
+
+ }
}