summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control/network
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub/control/network')
-rw-r--r--test/jrummikub/control/network/NetworkRoundControlTest.java70
1 files changed, 44 insertions, 26 deletions
diff --git a/test/jrummikub/control/network/NetworkRoundControlTest.java b/test/jrummikub/control/network/NetworkRoundControlTest.java
index 24360c6..f444581 100644
--- a/test/jrummikub/control/network/NetworkRoundControlTest.java
+++ b/test/jrummikub/control/network/NetworkRoundControlTest.java
@@ -35,8 +35,10 @@ public class NetworkRoundControlTest {
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));
+ gameSettings.getPlayerList().add(
+ new PlayerSettings("Jannis", Color.GREEN));
+ gameSettings.getPlayerList().add(
+ new PlayerSettings("Bennet", Color.BLACK));
gameSettings.getPlayerList().get(1).setType(Type.COMPUTER);
gameSettings.getPlayerList().get(2).setType(Type.NETWORK);
@@ -48,7 +50,8 @@ public class NetworkRoundControlTest {
@Test
public void testHostRound() {
- connectionControl.nickname = gameSettings.getPlayerList().get(0).getName();
+ connectionControl.nickname = gameSettings.getPlayerList().get(0)
+ .getName();
testRoundState = new RoundState(gameSettings, null);
testRound = new NetworkRoundControl(testRoundState, view,
@@ -64,8 +67,8 @@ public class NetworkRoundControlTest {
IPlayer player = testRoundState.getNthPlayer(i);
assertSame(gameSettings.getPlayerList().get(i),
player.getPlayerSettings());
- assertEquals(gameSettings.getNumberOfStonesDealt(), player.getHand()
- .getSize());
+ assertEquals(gameSettings.getNumberOfStonesDealt(), player
+ .getHand().getSize());
}
for (int i = 0; i < 4; ++i) {
@@ -77,45 +80,50 @@ public class NetworkRoundControlTest {
}
}
- assertSame(testRoundState.getNthPlayer(0), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(0),
+ testRoundState.getActivePlayer());
assertTrue(connectionControl.turnStarted);
connectionControl.turnStarted = false;
- connectionControl.turnStartEvent.emit(testRoundState);
+ connectionControl.turnStartEvent.emit();
assertFalse(connectionControl.turnEnded);
view.playerPanel.endTurnEvent.emit();
assertTrue(connectionControl.turnEnded);
connectionControl.turnEnded = false;
- assertSame(testRoundState.getNthPlayer(1), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(1),
+ testRoundState.getActivePlayer());
assertTrue(connectionControl.turnStarted);
connectionControl.turnStarted = false;
- connectionControl.turnStartEvent.emit(testRoundState);
+ connectionControl.turnStartEvent.emit();
assertTrue(connectionControl.turnEnded);
connectionControl.turnEnded = false;
- assertSame(testRoundState.getNthPlayer(2), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(2),
+ testRoundState.getActivePlayer());
assertTrue(connectionControl.turnStarted);
connectionControl.turnStarted = false;
- connectionControl.turnStartEvent.emit(testRoundState);
+ connectionControl.turnStartEvent.emit();
assertFalse(connectionControl.turnEnded);
- connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
- .getHand(), testRoundState.getTable(), testRoundState.getTable());
+ connectionControl.turnEndEvent.emit(testRoundState);
- assertSame(testRoundState.getNthPlayer(3), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(3),
+ testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
- .getHand(), testRoundState.getTable(), testRoundState.getTable());
+ .getHand(), testRoundState.getTable(), testRoundState
+ .getTable());
- assertSame(testRoundState.getNthPlayer(0), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(0),
+ testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
connectionControl.turnStartEvent.emit(testRoundState);
@@ -124,41 +132,49 @@ public class NetworkRoundControlTest {
@Test
public void testClientRound() {
- connectionControl.nickname = gameSettings.getPlayerList().get(2).getName();
+ connectionControl.nickname = gameSettings.getPlayerList().get(2)
+ .getName();
testRoundState = new RoundState(gameSettings, null);
for (int i = 0; i < 4; ++i) {
IPlayer player = testRoundState.getNthPlayer(i);
- player.getHand().drop(new Stone(StoneColor.RED), new Position(0, 0));
+ player.getHand()
+ .drop(new Stone(StoneColor.RED), new Position(0, 0));
}
- testRound = new NetworkRoundControl(null, view, connectionControl, false);
+ testRound = new NetworkRoundControl(null, view, connectionControl,
+ false);
connectionControl.turnStarted = false;
connectionControl.turnEnded = false;
testRound.startRound();
- assertSame(testRoundState.getNthPlayer(0), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(0),
+ testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
- .getHand(), testRoundState.getTable(), testRoundState.getTable());
+ .getHand(), testRoundState.getTable(), testRoundState
+ .getTable());
- assertSame(testRoundState.getNthPlayer(1), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(1),
+ testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
connectionControl.turnStartEvent.emit(testRoundState);
assertFalse(connectionControl.turnEnded);
connectionControl.turnEndEvent.emit(testRoundState.getActivePlayer()
- .getHand(), testRoundState.getTable(), testRoundState.getTable());
+ .getHand(), testRoundState.getTable(), testRoundState
+ .getTable());
- assertSame(testRoundState.getNthPlayer(2), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(2),
+ testRoundState.getActivePlayer());
assertFalse(connectionControl.turnStarted);
connectionControl.turnStartEvent.emit(testRoundState);
@@ -168,7 +184,8 @@ public class NetworkRoundControlTest {
assertTrue(connectionControl.turnEnded);
connectionControl.turnEnded = false;
- assertSame(testRoundState.getNthPlayer(3), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(3),
+ testRoundState.getActivePlayer());
assertTrue(connectionControl.turnStarted);
connectionControl.turnStarted = false;
@@ -176,7 +193,8 @@ public class NetworkRoundControlTest {
assertTrue(connectionControl.turnEnded);
connectionControl.turnEnded = false;
- assertSame(testRoundState.getNthPlayer(0), testRoundState.getActivePlayer());
+ assertSame(testRoundState.getNthPlayer(0),
+ testRoundState.getActivePlayer());
assertTrue(connectionControl.turnStarted);
connectionControl.turnStarted = false;