diff options
Diffstat (limited to 'test/jrummikub')
-rw-r--r-- | test/jrummikub/control/SettingsControlTest.java | 28 | ||||
-rw-r--r-- | test/jrummikub/control/turn/BaseAIControlTest.java | 15 |
2 files changed, 24 insertions, 19 deletions
diff --git a/test/jrummikub/control/SettingsControlTest.java b/test/jrummikub/control/SettingsControlTest.java index 534904d..a8e9849 100644 --- a/test/jrummikub/control/SettingsControlTest.java +++ b/test/jrummikub/control/SettingsControlTest.java @@ -9,6 +9,7 @@ import java.util.HashSet; import jrummikub.control.turn.TurnControlFactory; import jrummikub.model.GameSettings; +import jrummikub.model.PlayerSettings.Type; import jrummikub.model.StoneColor; import jrummikub.util.IListener1; import jrummikub.view.ISettingsPanel; @@ -41,7 +42,8 @@ public class SettingsControlTest { /** */ @Test public void initialStateTest() { - assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error); + assertSame(ISettingsPanel.SettingsError.NO_ERROR, + view.settingsPanel.error); view.settingsPanel.startGameEvent.emit(); assertNotNull(gameSettings); assertEquals(2, gameSettings.getPlayerList().size()); @@ -162,7 +164,8 @@ public class SettingsControlTest { view.settingsPanel.changePlayerNameEvent.emit(1, name2); assertTrue(view.settingsPanel.startButtonEnabled); - assertSame(ISettingsPanel.SettingsError.NO_ERROR, view.settingsPanel.error); + assertSame(ISettingsPanel.SettingsError.NO_ERROR, + view.settingsPanel.error); view.settingsPanel.startGameEvent.emit(); assertNotNull(gameSettings); @@ -243,8 +246,8 @@ public class SettingsControlTest { assertEquals(initialSettings.getStoneColors(), view.settingsPanel.stoneColors); - view.settingsPanel.changeStoneColorsEvent.emit(new HashSet<StoneColor>(Arrays.asList( - BLUE, RED, BLACK))); + view.settingsPanel.changeStoneColorsEvent.emit(new HashSet<StoneColor>( + Arrays.asList(BLUE, RED, BLACK))); view.settingsPanel.startGameEvent.emit(); assertEquals(new HashSet<StoneColor>(Arrays.asList(BLUE, RED, BLACK)), gameSettings.getStoneColors()); @@ -253,19 +256,16 @@ public class SettingsControlTest { /** */ @Test public void typeChangeTest() { - view.settingsPanel.changePlayerTypeEvent.emit(0, - TurnControlFactory.Type.COMPUTER); - view.settingsPanel.changePlayerTypeEvent.emit(1, - TurnControlFactory.Type.COMPUTER); - view.settingsPanel.changePlayerTypeEvent.emit(1, - TurnControlFactory.Type.HUMAN); + view.settingsPanel.changePlayerTypeEvent.emit(0, Type.COMPUTER); + view.settingsPanel.changePlayerTypeEvent.emit(1, Type.COMPUTER); + view.settingsPanel.changePlayerTypeEvent.emit(1, Type.HUMAN); view.settingsPanel.startGameEvent.emit(); assertNotNull(gameSettings); assertEquals(2, gameSettings.getPlayerList().size()); - assertSame(TurnControlFactory.Type.COMPUTER, gameSettings.getPlayerList() - .get(0).getTurnControlType()); - assertSame(TurnControlFactory.Type.HUMAN, - gameSettings.getPlayerList().get(1).getTurnControlType()); + assertSame(Type.COMPUTER, gameSettings.getPlayerList().get(0) + .getTurnControlType()); + assertSame(Type.HUMAN, gameSettings.getPlayerList().get(1) + .getTurnControlType()); } } diff --git a/test/jrummikub/control/turn/BaseAIControlTest.java b/test/jrummikub/control/turn/BaseAIControlTest.java index fe06398..51b1f1f 100644 --- a/test/jrummikub/control/turn/BaseAIControlTest.java +++ b/test/jrummikub/control/turn/BaseAIControlTest.java @@ -10,6 +10,7 @@ import jrummikub.model.IPlayer; import jrummikub.model.ITable;
import jrummikub.model.Player;
import jrummikub.model.PlayerSettings;
+import jrummikub.model.PlayerSettings.Type;
import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.model.StoneColor;
@@ -36,8 +37,7 @@ public class BaseAIControlTest { /** */
@Before
public void setUp() {
- aiControl = TurnControlFactory.getFactory(TurnControlFactory.Type.COMPUTER)
- .create();
+ aiControl = TurnControlFactory.getFactory(Type.COMPUTER).create();
gameSettings = new GameSettings();
playerSettings = new PlayerSettings("ROBOT_01", Color.GRAY);
player = new Player(playerSettings);
@@ -75,7 +75,8 @@ public class BaseAIControlTest { */
@Test(timeout = 10000)
public void testTurnZeroRedealing() throws InterruptedException {
- aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(), player.getLaidOut(), TurnMode.MAY_REDEAL), gameSettings, view);
+ aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
+ player.getLaidOut(), TurnMode.MAY_REDEAL), gameSettings, view);
aiControl.startTurn();
while (!redealt) {
Thread.sleep(100);
@@ -89,7 +90,10 @@ public class BaseAIControlTest { */
@Test(timeout = 10000)
public void testTurnZeroNotMelding() throws InterruptedException {
- aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(), player.getLaidOut(), TurnMode.INSPECT_ONLY), gameSettings, view);
+ aiControl
+ .setup(new ITurnControl.TurnInfo(table, player.getHand(),
+ player.getLaidOut(), TurnMode.INSPECT_ONLY),
+ gameSettings, view);
aiControl.startTurn();
while (!turnEnded) {
Thread.sleep(100);
@@ -103,7 +107,8 @@ public class BaseAIControlTest { */
@Test(timeout = 10000)
public void testNormalTurnMelding() throws InterruptedException {
- aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(), player.getLaidOut(), TurnMode.NORMAL_TURN), gameSettings, view);
+ aiControl.setup(new ITurnControl.TurnInfo(table, player.getHand(),
+ player.getLaidOut(), TurnMode.NORMAL_TURN), gameSettings, view);
aiControl.startTurn();
while (!turnEnded) {
Thread.sleep(100);
|