summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control/network
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-21 01:46:36 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-21 01:46:36 +0200
commit72912be6008039ea81f875fe3be911cd4d66a8d4 (patch)
treef519e7666719e1ede5ac2ba084484b91bbcfa0d9 /test/jrummikub/control/network
parentf304f20cbccca0fb959a4d2fabb31946e11580cb (diff)
downloadJRummikub-72912be6008039ea81f875fe3be911cd4d66a8d4.tar
JRummikub-72912be6008039ea81f875fe3be911cd4d66a8d4.zip
Tests für RoundControl gefixt
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@524 72836036-5685-4462-b002-a69064685172
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;