@Test public void testCreateBoardImpl() throws BoardCreationException { final ScribbleSettings settings = new ScribbleSettings("Mock", Language.EN, 3); final Dictionary dictionary = createNiceMock(Dictionary.class); replay(dictionary); final TilesBankInfoEditor editor = new TilesBankInfoEditor(Language.EN); final TilesBank tilesBank = new TilesBank(editor.add('A', 100, 1).createTilesBankInfo()); expect(dictionaryManager.getDictionary(Language.EN)).andReturn(dictionary); replay(dictionaryManager); expect(tilesBankingHouse.createTilesBank(Language.EN, 2, true)).andReturn(tilesBank); replay(tilesBankingHouse); scribblePlayManager.setDictionaryManager(dictionaryManager); scribblePlayManager.setTilesBankingHouse(tilesBankingHouse); final ScribbleBoard board1 = scribblePlayManager.createBoardImpl(settings, Arrays.asList(player1, player2), null); assertNotNull(board1); verify(dictionaryManager); verify(tilesBankingHouse); }
@Test public void testLoadBoardImpl() throws BoardLoadingException { final ScribbleSettings settings = new ScribbleSettings("Mock", Language.EN, 3); final Dictionary dictionary = createNiceMock(Dictionary.class); final TilesBank tilesBank = new TilesBank(new TilesBankInfoEditor(Language.EN).createTilesBankInfo()); final ScribbleBoard board = createStrictMock(ScribbleBoard.class); expect(board.getSettings()).andReturn(settings); expect(board.getPlayersCount()).andReturn(3); board.initGameAfterLoading(tilesBank, dictionary, personalityManager); replay(board); expect(session.get(ScribbleBoard.class, 1L)).andReturn(board); session.evict(board); replay(session); expect(dictionaryManager.getDictionary(Language.EN)).andReturn(dictionary); replay(dictionaryManager); expect(tilesBankingHouse.createTilesBank(Language.EN, 3, true)).andReturn(tilesBank); replay(tilesBankingHouse); final ScribbleBoard board1 = scribblePlayManager.loadBoardImpl(1L); assertSame(board, board1); verify(board); verify(session); verify(dictionaryManager); verify(tilesBankingHouse); }