From f3f8ffe4621e91d33732bba9e103ff790a16c7b3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 20 Jun 2011 03:59:04 +0200 Subject: Added NetworkGameControl git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@503 72836036-5685-4462-b002-a69064685172 --- .../control/network/MockConnectionControl.java | 13 +++++ mock/jrummikub/model/MockRoundState.java | 13 +++-- src/jrummikub/control/ApplicationControl.java | 2 +- src/jrummikub/control/GameControl.java | 55 +++++++++++++--------- src/jrummikub/control/RoundControl.java | 1 + .../control/network/AbstractGameBeginControl.java | 17 ------- .../control/network/ConnectionControl.java | 20 ++++++++ src/jrummikub/control/network/GameJoinControl.java | 15 +++++- .../control/network/GameOfferControl.java | 33 +++++++++++-- .../control/network/IConnectionControl.java | 4 ++ src/jrummikub/control/network/NetworkControl.java | 25 +++++++++- .../control/network/NetworkGameControl.java | 46 ++++++++++++++++++ src/jrummikub/model/IRoundState.java | 4 +- src/jrummikub/model/RoundState.java | 9 +++- test/jrummikub/control/RoundControlTest.java | 10 ++-- test/jrummikub/control/SaveControlTest.java | 11 ++--- .../control/network/GameJoinControlTest.java | 5 +- .../control/network/GameOfferControlTest.java | 7 +-- .../control/network/NetworkControlTest.java | 7 +-- .../control/network/NetworkRoundControlTest.java | 4 +- .../network/NetworkSettingsControlTest.java | 7 +-- test/jrummikub/model/RoundStateTest.java | 2 +- 22 files changed, 227 insertions(+), 83 deletions(-) create mode 100644 src/jrummikub/control/network/NetworkGameControl.java diff --git a/mock/jrummikub/control/network/MockConnectionControl.java b/mock/jrummikub/control/network/MockConnectionControl.java index d0bb1fa..32c22c4 100644 --- a/mock/jrummikub/control/network/MockConnectionControl.java +++ b/mock/jrummikub/control/network/MockConnectionControl.java @@ -37,6 +37,8 @@ public class MockConnectionControl implements IConnectionControl { /** */ public MockEvent gameStartEvent = new MockEvent(); /** */ + public MockEvent roundStartEvent = new MockEvent(); + /** */ public MockEvent1 tableUpdateEvent = new MockEvent1(); /** */ public MockEvent1 turnEndEvent = new MockEvent1(); @@ -124,6 +126,11 @@ public class MockConnectionControl implements IConnectionControl { return gameStartEvent; } + @Override + public IEvent getRoundStartEvent() { + return roundStartEvent; + } + @Override public IEvent1 getTableUpdateEvent() { return tableUpdateEvent; @@ -203,4 +210,10 @@ public class MockConnectionControl implements IConnectionControl { public void startTurn(IRoundState state) { turnStarted = true; } + + @Override + public void startRound() { + // TODO Auto-generated method stub + + } } diff --git a/mock/jrummikub/model/MockRoundState.java b/mock/jrummikub/model/MockRoundState.java index c387396..9b36906 100644 --- a/mock/jrummikub/model/MockRoundState.java +++ b/mock/jrummikub/model/MockRoundState.java @@ -26,14 +26,16 @@ public class MockRoundState implements IRoundState { /** */ public int turnNumber; /** */ - + public GameState gameState; + + /** */ public MockRoundState() { table = new MockTable(); players = new ArrayList(); players.add(new MockPlayer(new PlayerSettings("Player 1", Color.RED), gameSettings)); - players.add(new MockPlayer( - new PlayerSettings("Player 2", Color.YELLOW), gameSettings)); + players.add(new MockPlayer(new PlayerSettings("Player 2", Color.YELLOW), + gameSettings)); players.add(new MockPlayer(new PlayerSettings("Player 3", Color.GREEN), gameSettings)); players.add(new MockPlayer(new PlayerSettings("Player 4", Color.BLACK), @@ -126,4 +128,9 @@ public class MockRoundState implements IRoundState { public void nextTurn() { turnNumber++; } + + @Override + public GameState getGameState() { + return gameState; + } } diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java index bc16cb4..f4e5a23 100644 --- a/src/jrummikub/control/ApplicationControl.java +++ b/src/jrummikub/control/ApplicationControl.java @@ -206,7 +206,7 @@ public class ApplicationControl { private void createNetworkControl(LoginData loginData) { ConnectionControl connectionControl = new ConnectionControl(loginData); - networkControl = new NetworkControl(loginData, connectionControl, view); + networkControl = new NetworkControl(loginData, connectionControl, saveControl, view); networkControl.getStopNetworkEvent().add(new IListener() { @Override diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java index 66a96b6..ead4c51 100644 --- a/src/jrummikub/control/GameControl.java +++ b/src/jrummikub/control/GameControl.java @@ -20,24 +20,24 @@ import jrummikub.view.IView.BottomPanelType; * Controls a Game, at some point including all Rounds, starts new Rounds */ public class GameControl { - private SaveControl saveControl; + protected SaveControl saveControl; + protected GameSettings gameSettings; + protected IView view; + protected RoundControl roundControl; + protected GameState gameState; + protected List connections = new ArrayList(); - private GameSettings gameSettings; - private IView view; - RoundControl roundControl; - private GameState gameState; - private List connections = new ArrayList(); private Event endOfGameEvent = new Event(); /** * Constructor * * @param gameSettings - * the game settings + * the game settings * @param saveControl - * the save control + * the save control * @param view - * the view + * the view */ public GameControl(GameSettings gameSettings, SaveControl saveControl, IView view) { @@ -45,11 +45,13 @@ public class GameControl { this.saveControl = saveControl; this.view = view; - gameState = new GameState(); - saveControl.setGameState(gameState); + if (gameSettings != null) { + gameState = new GameState(); + saveControl.setGameState(gameState); - gameState.setFirstRoundFirstPlayer((int) (Math.random() * gameSettings - .getPlayerList().size())); + gameState.setFirstRoundFirstPlayer((int) (Math.random() * gameSettings + .getPlayerList().size())); + } connections.add(view.getNewRoundEvent().add(new IListener() { @Override @@ -104,9 +106,9 @@ public class GameControl { * Continues game after loading * * @param gameState - * the saved GameState (Players, startplayer, points) + * the saved GameState (Players, startplayer, points) * @param roundState - * the saved RoundState (activePlayer, Table, heap etc) + * the saved RoundState (activePlayer, Table, heap etc) */ public void continueGame(GameState gameState, IRoundState roundState) { this.gameState = gameState; @@ -133,14 +135,14 @@ public class GameControl { view.clearView(); } - private void startRound() { + protected void startRound() { if (roundControl != null) { return; } view.showScorePanel(false); - IRoundState roundState = new RoundState(gameSettings); + IRoundState roundState = createRoundState(); prepareRound(roundState); roundControl.startRound(); } @@ -148,10 +150,12 @@ public class GameControl { private void prepareRound(IRoundState roundState) { saveControl.setRoundState(roundState); - roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer() - + gameState.getScores().size()); + if (roundState != null) { + roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer() + + gameState.getScores().size()); + } - roundControl = new RoundControl(roundState, view); + roundControl = createRoundControl(roundState); roundControl.getEndOfRoundEvent().add(new IListener1() { @Override @@ -169,6 +173,14 @@ public class GameControl { }); } + protected IRoundState createRoundState() { + return new RoundState(gameSettings, gameState); + } + + protected RoundControl createRoundControl(IRoundState roundState) { + return new RoundControl(roundState, view); + } + private void restartRound() { roundControl = null; startRound(); @@ -188,8 +200,7 @@ public class GameControl { view.getScorePanel().setPlayers(gameSettings.getPlayerList()); view.getScorePanel().setScores(gameState.getScores()); - view.getScorePanel().setAccumulatedScore( - gameState.getAccumulatedScore()); + view.getScorePanel().setAccumulatedScore(gameState.getAccumulatedScore()); view.getScorePanel().update(); view.showScorePanel(true); } diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index ac3acf3..408c275 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -244,6 +244,7 @@ public class RoundControl { } } + view.getSidePanel().setHeapSize(roundState.getGameHeap().getSize()); } private boolean laidOutValidPoints() { diff --git a/src/jrummikub/control/network/AbstractGameBeginControl.java b/src/jrummikub/control/network/AbstractGameBeginControl.java index 341f94e..4fc0cc6 100644 --- a/src/jrummikub/control/network/AbstractGameBeginControl.java +++ b/src/jrummikub/control/network/AbstractGameBeginControl.java @@ -11,10 +11,8 @@ import jrummikub.model.PlayerSettings; import jrummikub.model.PlayerSettings.Type; import jrummikub.util.Connection; import jrummikub.util.Event; -import jrummikub.util.Event1; import jrummikub.util.GameData; import jrummikub.util.IEvent; -import jrummikub.util.IEvent1; import jrummikub.util.IListener; import jrummikub.util.IListener2; import jrummikub.view.ISettingsPanel; @@ -31,7 +29,6 @@ public abstract class AbstractGameBeginControl { protected IConnectionControl connectionControl; protected IView view; protected Event backEvent = new Event(); - private Event1 gameStartEvent = new Event1(); /** * Create a new game begin control @@ -115,20 +112,6 @@ public abstract class AbstractGameBeginControl { return backEvent; } - /** - * The event that is emitted when the game is started - * - * @return the event - */ - public IEvent1 getStartTurnEvent() { - return gameStartEvent; - } - - protected void startGame() { - abort(); - gameStartEvent.emit(gameData); - } - protected void abort() { view.showSettingsPanel(false); for (Connection c : connections) { diff --git a/src/jrummikub/control/network/ConnectionControl.java b/src/jrummikub/control/network/ConnectionControl.java index 54c9512..d791344 100644 --- a/src/jrummikub/control/network/ConnectionControl.java +++ b/src/jrummikub/control/network/ConnectionControl.java @@ -60,6 +60,7 @@ public class ConnectionControl implements IConnectionControl { private Event2 changeColorEvent = new Event2(); private Event gameStartEvent = new Event(); + private Event roundStartEvent = new Event(); private Event1 tableUpdateEvent = new Event1(); private Event1 turnEndEvent = new Event1(); @@ -151,6 +152,11 @@ public class ConnectionControl implements IConnectionControl { return gameStartEvent; } + @Override + public IEvent getRoundStartEvent() { + return roundStartEvent; + } + @Override public IEvent1 getTableUpdateEvent() { return tableUpdateEvent; @@ -270,6 +276,18 @@ public class ConnectionControl implements IConnectionControl { }); } + @Override + public void startRound() { + final UUID uuid = currentGame.getGameID(); + run(new SendRunner() { + @Override + protected void addData(DefaultPacketExtension extension) { + extension.setValue("messageType", "round_start"); + extension.setValue("uuid", uuid.toString()); + } + }); + } + @Override public void updateTable(final ITable table) { final UUID uuid = currentGame.getGameID(); @@ -414,6 +432,8 @@ public class ConnectionControl implements IConnectionControl { (Color) Base64.decodeToObject(extension.getValue("color"))); } else if (messageType.equals("game_start")) { gameStartEvent.emit(); + } else if (messageType.equals("round_start")) { + roundStartEvent.emit(); } else if (messageType.equals("table_update")) { tableUpdateEvent.emit((ITable) Base64.decodeToObject(extension .getValue("table"))); diff --git a/src/jrummikub/control/network/GameJoinControl.java b/src/jrummikub/control/network/GameJoinControl.java index b9690b6..5d31e74 100644 --- a/src/jrummikub/control/network/GameJoinControl.java +++ b/src/jrummikub/control/network/GameJoinControl.java @@ -5,7 +5,9 @@ import java.util.UUID; import jrummikub.model.GameSettings; import jrummikub.model.PlayerSettings; import jrummikub.model.PlayerSettings.Type; +import jrummikub.util.Event; import jrummikub.util.GameData; +import jrummikub.util.IEvent; import jrummikub.util.IListener; import jrummikub.util.IListener1; import jrummikub.view.ISettingsPanel.SettingsMode; @@ -15,6 +17,7 @@ import jrummikub.view.IView; * Control for joining a network game */ public class GameJoinControl extends AbstractGameBeginControl { + private Event gameStartEvent = new Event(); /** * Creates new game join control @@ -63,11 +66,21 @@ public class GameJoinControl extends AbstractGameBeginControl { connections.add(connectionControl.getGameStartEvent().add(new IListener() { @Override public void handle() { - startGame(); + abort(); + gameStartEvent.emit(); } })); } + /** + * The event that is emitted when the game is started + * + * @return the event + */ + public IEvent getStartGameEvent() { + return gameStartEvent; + } + private void fixGameSettings(GameSettings settings) { for (PlayerSettings player : settings.getPlayerList()) { if (player.getType() == Type.HUMAN) { diff --git a/src/jrummikub/control/network/GameOfferControl.java b/src/jrummikub/control/network/GameOfferControl.java index 8c5820d..42e3b8b 100644 --- a/src/jrummikub/control/network/GameOfferControl.java +++ b/src/jrummikub/control/network/GameOfferControl.java @@ -1,12 +1,15 @@ package jrummikub.control.network; +import java.util.Iterator; import java.util.List; import java.util.UUID; import jrummikub.model.GameSettings; import jrummikub.model.PlayerSettings; import jrummikub.model.PlayerSettings.Type; +import jrummikub.util.Event1; import jrummikub.util.GameData; +import jrummikub.util.IEvent1; import jrummikub.util.IListener; import jrummikub.util.IListener1; import jrummikub.view.ISettingsPanel.SettingsMode; @@ -16,6 +19,7 @@ import jrummikub.view.IView; * Control for network game host */ public class GameOfferControl extends AbstractGameBeginControl { + private Event1 gameStartEvent = new Event1(); /** * Creates new game offer control @@ -84,10 +88,32 @@ public class GameOfferControl extends AbstractGameBeginControl { })); } - @Override - protected void startGame() { - super.startGame(); + /** + * The event that is emitted when the game is started + * + * @return the event + */ + public IEvent1 getStartGameEvent() { + return gameStartEvent; + } + + private void startGame() { + abort(); connectionControl.startGame(); + + GameSettings settings = gameData.getGameSettings(); + removeVacant(settings); + + gameStartEvent.emit(settings); + } + + private void removeVacant(GameSettings settings) { + Iterator it = settings.getPlayerList().iterator(); + while (it.hasNext()) { + if (it.next().getType() == Type.VACANT) { + it.remove(); + } + } } /** @@ -98,7 +124,6 @@ public class GameOfferControl extends AbstractGameBeginControl { connectionControl.offerGame(gameData); view.showSettingsPanel(true); - } @Override diff --git a/src/jrummikub/control/network/IConnectionControl.java b/src/jrummikub/control/network/IConnectionControl.java index ff23c82..52c7fd1 100644 --- a/src/jrummikub/control/network/IConnectionControl.java +++ b/src/jrummikub/control/network/IConnectionControl.java @@ -37,6 +37,8 @@ interface IConnectionControl { public IEvent getGameStartEvent(); + public IEvent getRoundStartEvent(); + public IEvent1 getTableUpdateEvent(); public IEvent1 getTurnEndEvent(); @@ -61,6 +63,8 @@ interface IConnectionControl { public void startGame(); + public void startRound(); + public void updateTable(ITable table); public void endTurn(ITable table); diff --git a/src/jrummikub/control/network/NetworkControl.java b/src/jrummikub/control/network/NetworkControl.java index 60640db..6579b0f 100644 --- a/src/jrummikub/control/network/NetworkControl.java +++ b/src/jrummikub/control/network/NetworkControl.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import jrummikub.control.SaveControl; import jrummikub.model.GameSettings; import jrummikub.util.Connection; import jrummikub.util.Event; @@ -31,6 +32,10 @@ public class NetworkControl { private GameOfferControl gameOfferControl; private GameJoinControl gameJoinControl; + private SaveControl saveControl; + + private NetworkGameControl gameControl; + private List games = new ArrayList(); private Map gameMap = new HashMap(); @@ -45,9 +50,11 @@ public class NetworkControl { * for events and handlers */ public NetworkControl(final LoginData loginData, - IConnectionControl connectionControl, final IView view) { + IConnectionControl connectionControl, SaveControl saveControl, + final IView view) { this.view = view; this.connectionControl = connectionControl; + this.saveControl = saveControl; addConnectionSetupListeners(loginData, view); addConnectionControlListeners(view); @@ -186,6 +193,14 @@ public class NetworkControl { view.showGameListPanel(true); } }); + gameJoinControl.getStartGameEvent().add(new IListener() { + @Override + public void handle() { + gameControl = new NetworkGameControl(null, saveControl, view, + connectionControl, false); + gameControl.startGame(); + } + }); gameJoinControl.startGameJoin(); } @@ -271,6 +286,14 @@ public class NetworkControl { view.showGameListPanel(true); } }); + gameOfferControl.getStartGameEvent().add(new IListener1() { + @Override + public void handle(GameSettings settings) { + gameControl = new NetworkGameControl(settings, saveControl, view, + connectionControl, true); + gameControl.startGame(); + } + }); gameOfferControl.startGameOffer(); } diff --git a/src/jrummikub/control/network/NetworkGameControl.java b/src/jrummikub/control/network/NetworkGameControl.java new file mode 100644 index 0000000..1040909 --- /dev/null +++ b/src/jrummikub/control/network/NetworkGameControl.java @@ -0,0 +1,46 @@ +package jrummikub.control.network; + +import jrummikub.control.GameControl; +import jrummikub.control.RoundControl; +import jrummikub.control.SaveControl; +import jrummikub.model.GameSettings; +import jrummikub.model.IRoundState; +import jrummikub.util.IListener; +import jrummikub.view.IView; + +public class NetworkGameControl extends GameControl { + private IConnectionControl connectionControl; + private boolean host; + + public NetworkGameControl(GameSettings gameSettings, SaveControl saveControl, + IView view, IConnectionControl connectionControl, boolean host) { + super(gameSettings, saveControl, view); + + this.connectionControl = connectionControl; + this.host = host; + } + + @Override + public void startGame() { + connections.add(connectionControl.getRoundStartEvent().add(new IListener() { + @Override + public void handle() { + startRound(); + } + })); + + if (host) { + connectionControl.startRound(); + } + } + + @Override + protected IRoundState createRoundState() { + return host ? super.createRoundState() : null; + } + + @Override + protected RoundControl createRoundControl(IRoundState roundState) { + return new NetworkRoundControl(roundState, view, connectionControl, host); + } +} diff --git a/src/jrummikub/model/IRoundState.java b/src/jrummikub/model/IRoundState.java index d394694..1ac0ac2 100644 --- a/src/jrummikub/model/IRoundState.java +++ b/src/jrummikub/model/IRoundState.java @@ -96,13 +96,15 @@ public interface IRoundState extends Serializable { */ public void setActivePlayerNumber(int i); + public GameState getGameState(); + /** * Gets the number of the current turn. Numbers smaller than one indicate hand * inspection turns * * @return current turn number */ - public abstract int getTurnNumber(); + public int getTurnNumber(); /** * Increments the turn number diff --git a/src/jrummikub/model/RoundState.java b/src/jrummikub/model/RoundState.java index e2125a7..2c50089 100644 --- a/src/jrummikub/model/RoundState.java +++ b/src/jrummikub/model/RoundState.java @@ -7,6 +7,7 @@ public class RoundState implements IRoundState { private static final long serialVersionUID = 8678490099871939059L; private GameSettings gameSettings; + private GameState gameState; private ITable table; private ArrayList players; @@ -21,8 +22,9 @@ public class RoundState implements IRoundState { * @param gameSettings * the game settings */ - public RoundState(GameSettings gameSettings) { + public RoundState(GameSettings gameSettings, GameState gameState) { this.gameSettings = gameSettings; + this.gameState = gameState; table = new Table(gameSettings); players = new ArrayList(); @@ -118,4 +120,9 @@ public class RoundState implements IRoundState { public void nextTurn() { turnNumber++; } + + @Override + public GameState getGameState() { + return gameState; + } } diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index d37a370..4eefe2e 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -51,7 +51,7 @@ public class RoundControlTest { private boolean roundEnded; private Score roundScore; protected boolean roundRestarted; - + Stone blueFour = new Stone(4, BLUE); Stone blackFour = new Stone(4, BLACK); Stone redFour = new Stone(4, RED); @@ -67,15 +67,15 @@ public class RoundControlTest { Stone blueOne = new Stone(1, BLUE); Stone blueTwo = new Stone(2, BLUE); Stone blueThree = new Stone(3, BLUE); - + Stone blueTen = new Stone(10, BLUE); Stone redTen = new Stone(10, RED); Stone blueEleven = new Stone(11, BLUE); - + Stone redEight = new Stone(8, RED); Stone redNine = new Stone(9, RED); Stone redEleven = new Stone(11, RED); - + Stone blueEight = new Stone(8, BLUE); Stone blackEight = new Stone(8, BLACK); Stone orangeEight = new Stone(8, ORANGE); @@ -105,7 +105,7 @@ public class RoundControlTest { new PlayerSettings("Matthias", Color.YELLOW)); gameSettings.getPlayerList().add(new PlayerSettings("Jannis", Color.GREEN)); gameSettings.getPlayerList().add(new PlayerSettings("Bennet", Color.BLACK)); - roundState = new RoundState(gameSettings); + roundState = new RoundState(gameSettings, null); roundControl = new RoundControl(roundState, view); } diff --git a/test/jrummikub/control/SaveControlTest.java b/test/jrummikub/control/SaveControlTest.java index 72dba75..66a57cd 100644 --- a/test/jrummikub/control/SaveControlTest.java +++ b/test/jrummikub/control/SaveControlTest.java @@ -24,7 +24,7 @@ import org.junit.Test; public class SaveControlTest { /** * @throws IOException - * if input cannot be saved/loaded + * if input cannot be saved/loaded */ @Test public void testSaveLoad() throws IOException { @@ -33,7 +33,7 @@ public class SaveControlTest { settings.getPlayerList().add(new PlayerSettings("Ida", Color.PINK)); GameState gameState = new GameState(); - RoundState roundState = new RoundState(settings); + RoundState roundState = new RoundState(settings, null); Stone stone1 = new Stone(1, RED); Stone stone2 = new Stone(5, RED); @@ -57,12 +57,11 @@ public class SaveControlTest { new IListener3() { @Override - public void handle(GameSettings settings, - GameState gameState, IRoundState roundState) { + public void handle(GameSettings settings, GameState gameState, + IRoundState roundState) { assertEquals(2, settings.getPlayerList().size()); assertEquals(1, roundState.getTable().getSize()); - assertEquals(2, roundState.getActivePlayer().getHand() - .getSize()); + assertEquals(2, roundState.getActivePlayer().getHand().getSize()); } }); diff --git a/test/jrummikub/control/network/GameJoinControlTest.java b/test/jrummikub/control/network/GameJoinControlTest.java index d2f3f9c..179c583 100644 --- a/test/jrummikub/control/network/GameJoinControlTest.java +++ b/test/jrummikub/control/network/GameJoinControlTest.java @@ -1,7 +1,6 @@ package jrummikub.control.network; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.awt.Color; import java.util.UUID; @@ -37,7 +36,7 @@ public class GameJoinControlTest { mockConnection.nickname = "Karl"; view = new MockView(); loginData = new LoginData("Karl", "server", "password", "channel"); - networkControl = new NetworkControl(loginData, mockConnection, view); + networkControl = new NetworkControl(loginData, mockConnection, null, view); networkControl.startNetwork(); mockConnection.connectedEvent.emit(); diff --git a/test/jrummikub/control/network/GameOfferControlTest.java b/test/jrummikub/control/network/GameOfferControlTest.java index a922967..635ea57 100644 --- a/test/jrummikub/control/network/GameOfferControlTest.java +++ b/test/jrummikub/control/network/GameOfferControlTest.java @@ -1,9 +1,6 @@ package jrummikub.control.network; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.awt.Color; import java.util.UUID; @@ -36,7 +33,7 @@ public class GameOfferControlTest { mockConnection.nickname = "Karl"; view = new MockView(); loginData = new LoginData("Karl", "server", "password", "channel"); - networkControl = new NetworkControl(loginData, mockConnection, view); + networkControl = new NetworkControl(loginData, mockConnection, null, view); networkControl.startNetwork(); mockConnection.connectedEvent.emit(); diff --git a/test/jrummikub/control/network/NetworkControlTest.java b/test/jrummikub/control/network/NetworkControlTest.java index f805c73..2be4da0 100644 --- a/test/jrummikub/control/network/NetworkControlTest.java +++ b/test/jrummikub/control/network/NetworkControlTest.java @@ -1,9 +1,6 @@ package jrummikub.control.network; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.awt.Color; import java.util.UUID; @@ -38,7 +35,7 @@ public class NetworkControlTest { mockConnection.nickname = "Karl"; view = new MockView(); loginData = new LoginData("Karl", "server", "password", "channel"); - networkControl = new NetworkControl(loginData, mockConnection, view); + networkControl = new NetworkControl(loginData, mockConnection, null, view); networkControl.startNetwork(); } diff --git a/test/jrummikub/control/network/NetworkRoundControlTest.java b/test/jrummikub/control/network/NetworkRoundControlTest.java index d13287b..b388998 100644 --- a/test/jrummikub/control/network/NetworkRoundControlTest.java +++ b/test/jrummikub/control/network/NetworkRoundControlTest.java @@ -47,7 +47,7 @@ public class NetworkRoundControlTest { gameSettings.getPlayerList().get(1).setType(Type.COMPUTER); gameSettings.getPlayerList().get(2).setType(Type.NETWORK); gameSettings.getPlayerList().get(3).setType(Type.COMPUTER); - testRoundState = new RoundState(gameSettings); + testRoundState = new RoundState(gameSettings, null); testRound = new NetworkRoundControl(testRoundState, view, connectionControl, true); @@ -122,7 +122,7 @@ public class NetworkRoundControlTest { gameSettings.getPlayerList().get(0).setType(Type.NETWORK); gameSettings.getPlayerList().get(1).setType(Type.COMPUTER); gameSettings.getPlayerList().get(3).setType(Type.COMPUTER); - testRoundState = new RoundState(gameSettings); + testRoundState = new RoundState(gameSettings, null); for (int i = 0; i < 4; ++i) { IPlayer player = testRoundState.getNthPlayer(i); diff --git a/test/jrummikub/control/network/NetworkSettingsControlTest.java b/test/jrummikub/control/network/NetworkSettingsControlTest.java index c8bb7af..bacbd6a 100644 --- a/test/jrummikub/control/network/NetworkSettingsControlTest.java +++ b/test/jrummikub/control/network/NetworkSettingsControlTest.java @@ -1,9 +1,6 @@ package jrummikub.control.network; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.util.UUID; @@ -35,7 +32,7 @@ public class NetworkSettingsControlTest { mockConnection.nickname = "Karl"; view = new MockView(); loginData = new LoginData("Karl", "server", "password", "channel"); - networkControl = new NetworkControl(loginData, mockConnection, view); + networkControl = new NetworkControl(loginData, mockConnection, null, view); networkControl.startNetwork(); mockConnection.connectedEvent.emit(); diff --git a/test/jrummikub/model/RoundStateTest.java b/test/jrummikub/model/RoundStateTest.java index bfbe857..515161b 100644 --- a/test/jrummikub/model/RoundStateTest.java +++ b/test/jrummikub/model/RoundStateTest.java @@ -21,7 +21,7 @@ public class RoundStateTest { settings.getPlayerList().add(new PlayerSettings("Player 2", Color.YELLOW)); settings.getPlayerList().add(new PlayerSettings("Player 3", Color.BLUE)); - testRound = new RoundState(settings); + testRound = new RoundState(settings, null); } /** */ -- cgit v1.2.3