Esempio n. 1
0
 @Test
 public void schiebe() {
   assertEquals(PlayerToken.PLAYER0, match.getActivePlayer());
   match.schiebe();
   assertTrue(match.isGeschoben());
   assertEquals(PlayerToken.PLAYER2, match.getActivePlayer());
   match.setAnsage(new Ansage(CardSuit.HEARTS));
   assertEquals(PlayerToken.PLAYER0, match.getActivePlayer());
 }
Esempio n. 2
0
  @Test
  public void testIsComplete() {
    Ansage ansage = new Ansage(SpielModi.OBENABE);
    Card winnerCard = mock(Card.class);
    when(winnerCard.getPlayer()).thenReturn(PlayerToken.PLAYER0);
    match.setAnsage(ansage);
    when(jassRulesMock.isCardPlayable(
            any(Card.class),
            anyListOf(Card.class),
            anyListOf(Card.class),
            eq(new Ansage(SpielModi.OBENABE)),
            anyBoolean()))
        .thenReturn(true);
    when(scoreUtilMock.getWinnerCard(anyListOf(Card.class), eq(ansage))).thenReturn(winnerCard);

    assertFalse(match.isComplete());

    for (int i = 0; i < 36; i++) {
      if (i % 4 == 0 && i != 0) {
        match.collectCards();
      }
      match.playCard(match.getCards(match.getActivePlayer()).get(0));
    }
    assertTrue(match.isComplete());
  }
Esempio n. 3
0
  @Test
  public void testGetActivePlayer() {
    Card card = cards.get(0);
    Ansage ansage = new Ansage(SpielModi.OBENABE);
    match.setAnsage(ansage);
    when(jassRulesMock.isCardPlayable(
            any(Card.class),
            anyListOf(Card.class),
            anyListOf(Card.class),
            eq(ansage),
            anyBoolean()))
        .thenReturn(true);

    assertEquals(playerList.get(0), match.getActivePlayer());
    match.playCard(card);
    assertEquals(playerList.get(1), match.getActivePlayer());
  }