コード例 #1
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());
  }
コード例 #2
0
 @Before
 public void setup() {
   thirdPlayerStrategy = new ThirdPlayerStrategy();
   cardsInHand = new ArrayList<Card>();
   cardsOnTable = new ArrayList<PlayedCard>();
   match = mock(MatchImpl.class);
   when(match.isCardPlayable(any(Card.class))).thenReturn(true);
   when(match.getCardsOnTable()).thenReturn(cardsOnTable);
   when(match.getCards(any(PlayerToken.class))).thenReturn(cardsInHand);
   when(match.getAnsage()).thenReturn(new Ansage(CardSuit.HEARTS));
 }
コード例 #3
0
 @Test
 public void testGetCardsFromPlayer1() {
   List<Card> cardsPlayer0 = match.getCards(playerList.get(1));
   assertEquals(9, cardsPlayer0.size());
   assertEquals(cards.subList(9, 18), cardsPlayer0);
 }