Пример #1
0
  @Test
  public void getNumberOfPlayersShouldReturnTotalNumberOfHumanPlayers() {
    when(mockGameFactory.create(1, 0, true, false, null, true, GameMode.EVENT))
        .thenReturn(mockGame1);
    when(mockGame1.getNumberOfHumanPlayer()).thenReturn(1);

    when(mockGameFactory.create(2, 0, true, false, null, false, GameMode.EVENT))
        .thenReturn(mockGame2);
    when(mockGame2.getNumberOfHumanPlayer()).thenReturn(2);

    gameManager.getOrCreateMatchingSession(
        GameMode.EVENT,
        "public EVENT name",
        0,
        null,
        EnumSet.of(ProblemGenre.Anige),
        EnumSet.of(ProblemType.Marubatsu),
        true,
        mockServerStatusManager,
        12345678,
        "192.168.0.1");
    gameManager.getOrCreateMatchingSession(
        GameMode.EVENT,
        "closed EVENT name",
        0,
        null,
        EnumSet.of(ProblemGenre.Anige),
        EnumSet.of(ProblemType.Marubatsu),
        false,
        mockServerStatusManager,
        12345678,
        "192.168.0.1");

    assertEquals(3, gameManager.getNumberOfPlayers());
  }