From 72912be6008039ea81f875fe3be911cd4d66a8d4 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Tue, 21 Jun 2011 01:46:36 +0200 Subject: =?UTF-8?q?Tests=20f=C3=BCr=20RoundControl=20gefixt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@524 72836036-5685-4462-b002-a69064685172 --- .../control/network/NetworkRoundControlTest.java | 70 ++++++++++++++-------- 1 file changed, 44 insertions(+), 26 deletions(-) (limited to 'test/jrummikub/control/network') 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; -- cgit v1.2.3