コード例 #1
0
  @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);
  }
コード例 #2
0
  @Before
  public void testSetUp() {
    session = createStrictMock(Session.class);

    final SessionFactory sessionFactory = createMock(SessionFactory.class);
    expect(sessionFactory.getCurrentSession()).andReturn(session).anyTimes();
    replay(sessionFactory);

    personalityManager = createStrictMock(PersonalityManager.class);
    dictionaryManager = createStrictMock(DictionaryManager.class);
    tilesBankingHouse = createStrictMock(TilesBankingHouse.class);

    scribblePlayManager = new ScribblePlayManager();
    scribblePlayManager.setSessionFactory(sessionFactory);
    scribblePlayManager.setPersonalityManager(personalityManager);
    scribblePlayManager.setDictionaryManager(dictionaryManager);
    scribblePlayManager.setTilesBankingHouse(tilesBankingHouse);
  }