@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));
 }
示例#2
0
  @Test
  public void testGetCardsOnTable() {
    Card card = cards.get(0);
    Ansage ansage = new Ansage(SpielModi.OBENABE);
    match.setAnsage(ansage);
    when(jassRulesMock.isCardPlayable(
            card, cards.subList(0, 9), new ArrayList<Card>(), ansage, true))
        .thenReturn(true);
    match.playCard(card);

    List<Card> cardsOnTable = match.getCardsOnTable();
    assertEquals(1, cardsOnTable.size());
    Card playedCard = cardsOnTable.get(0);
    assertEquals(card, playedCard);
    assertEquals(playerList.get(0), playedCard.getPlayer());
  }