@Test
  public void test_initializeBoard() {
    final Dictionary dict = createDictionary();
    final TilesBank tilesBank =
        new TilesBank(new TilesBankInfoEditor(Language.EN).add('a', 103, 1).createTilesBankInfo());

    final ScribbleBoard board =
        new ScribbleBoard(settings, Arrays.asList(player1, player2, player3), tilesBank, dict);
    h1 = board.getPlayerHand(player1);
    h2 = board.getPlayerHand(player2);
    h3 = board.getPlayerHand(player3);

    assertEquals(LETTERS_IN_HAND, h1.getTiles().length);
    assertEquals(LETTERS_IN_HAND, h2.getTiles().length);
    assertEquals(LETTERS_IN_HAND, h3.getTiles().length);
    assertNull(board.getResolution());
  }
  private ScribblePlayerHand doSmallGame(final RobotType robotType)
      throws BoardCreationException, InterruptedException {
    long currentTime = System.currentTimeMillis();
    assertNotNull("No room manager", scribbleBoardManager);
    final Visitor player = new DefaultVisitor(Language.RU);
    final ScribbleSettings settings =
        new ScribbleSettings("This is robots game", player.getLanguage(), 3, true, true);
    scribbleBoardManager.addBoardListener(
        new BoardListener() {
          @Override
          public void gameStarted(
              GameBoard<? extends GameSettings, ? extends GamePlayerHand, ? extends GameMove> b) {
            passGuestTurn(b);
          }

          @Override
          public void gameMoveDone(
              GameBoard<? extends GameSettings, ? extends GamePlayerHand, ? extends GameMove> b,
              GameMove move,
              GameMoveScore moveScore) {
            passGuestTurn(b);
          }

          @Override
          public void gameFinished(
              GameBoard<? extends GameSettings, ? extends GamePlayerHand, ? extends GameMove> b,
              GameResolution resolution,
              Collection<Personality> winners) {
            notifyGameFinished();
          }

          private void passGuestTurn(
              GameBoard<? extends GameSettings, ? extends GamePlayerHand, ? extends GameMove> b) {
            if (b.getPlayerTurn() == player) {
              ScribbleBoard sb = (ScribbleBoard) b;
              try {
                if (Math.random() < 0.5) {
                  final ScribblePlayerHand playerHand = sb.getPlayerHand(player);
                  final Tile[] tiles1 = playerHand.getTiles();
                  final int length = Math.min(tiles1.length, sb.getBankRemained());
                  if (length == 0) {
                    sb.passTurn(player);
                  } else {
                    int[] tiles = new int[length];
                    for (int i = 0; i < length; i++) {
                      tiles[i] = tiles1[i].getNumber();
                    }
                    sb.exchangeTiles(player, tiles);
                  }
                } else {
                  sb.passTurn(player);
                }
              } catch (GameMoveException e) {
                log.error("Something wrong", e);
                notifyGameFinished();
              }
            }
          }
        });

    final ScribbleBoard board = scribbleBoardManager.createBoard(settings, player, robotType);
    assertTrue("Game is not in progress state", board.isActive());

    gameFinishedLock.lock();
    while (board.isActive()) {
      gameFinishedCondition.await();
    }
    gameFinishedLock.unlock();

    log.info("Game was finished at {}ms ", +(System.currentTimeMillis() - currentTime));

    assertTrue("Board is not saved", board.getBoardId() > 0);
    assertFalse("Board is not finished", board.isActive());
    assertTrue("Board has no one move", board.getGameMoves().size() > 0);
    final Personality playerTurn = board.getPlayerTurn();
    if (board.getResolution() == GameResolution.RESIGNED
        || board.getResolution() == GameResolution.INTERRUPTED) {
      assertNotNull("Board has a player who has a turn: " + playerTurn, playerTurn);
    } else {
      assertNull("Board has a player who has a turn: " + playerTurn, playerTurn);
    }

    final Robot robot = (Robot) board.getPlayers().get(1);
    final ScribblePlayerHand playerHand = board.getPlayerHand(robot);
    assertTrue(playerHand.getPoints() > 0);
    assertTrue(playerHand.getOldRating() == robot.getRating());
    assertTrue(playerHand.getNewRating() > robot.getRating());
    return playerHand;
  }