コード例 #1
0
  /**
   * Start a new server game, using a *copy* of a supplied map.
   *
   * @param map The <code>Map</code> to copy.
   * @param spec The <code>Specification</code> to use.
   * @return The new running server game.
   */
  public static Game startServerGame(Map map, Specification spec) {
    stopServerGame();
    FreeColServer serv = startServer(false, true, spec);
    serv.setMapGenerator(new MockMapGenerator(serv.getGame(), map));
    PreGameController pgc = (PreGameController) serv.getController();
    try {
      pgc.startGame();
    } catch (FreeColException e) {
      fail("Failed to start game: " + e.getMessage());
    }

    Game game = serv.getGame();
    FreeColTestCase.setGame(game);
    if (game.getCurrentPlayer() == null) {
      game.setCurrentPlayer(game.getFirstPlayer());
    }
    random = new Random();
    return game;
  }
コード例 #2
0
 public static FreeColServer startServer(boolean publicServer, boolean singlePlayer) {
   return startServer(publicServer, singlePlayer, FreeColTestCase.spec());
 }
コード例 #3
0
 public static void stopServerGame() {
   stopServer();
   FreeColTestCase.setGame(null);
 }
コード例 #4
0
 /**
  * Start a new server game, using a *copy* of a supplied map.
  *
  * @param map The <code>Map</code> to copy.
  * @return The new running server game.
  */
 public static Game startServerGame(Map map) {
   return startServerGame(map, FreeColTestCase.spec());
 }
コード例 #5
0
 @Override
 public void tearDown() throws Exception {
   ServerTestHelper.stopServerGame();
   super.tearDown();
 }