Commit c2ad36d7 authored by Thomas DENIS's avatar Thomas DENIS
Browse files

Ajout des tests pour Deck

parent 5f93b2b9
package fr.univnantes.alma.server.game.item.player.hand; package fr.univnantes.alma.server.game.item.player.hand;
import fr.univnantes.alma.server.game.item.Phase;
import fr.univnantes.alma.server.game.item.card.Card;
import fr.univnantes.alma.server.game.item.card.CardName;
import fr.univnantes.alma.server.game.item.card.PlayerCard;
import fr.univnantes.alma.server.game.item.card.SurvivalCard;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertEquals;
class DeckTest { class DeckTest {
/*
Deck deck; Deck deck;
PlayerCard card; PlayerCard card;
List<Card> cardList; List<Card> cardList;
@BeforeEach @BeforeEach
public void setUp(){ public void setUp(){
deck = new Deck(6); deck = new Deck(6);
// card = new PlayerCard("ID", "Name", "Description", new PowerContainer(), 1); card = new SurvivalCard(CardName.ADRENALINE,"nom","description", Phase.PHASE_1);
//TODO cardList = new ArrayList<>();
cardList = new ArrayList<>(); }
@Test
public void testGetMaxCards(){
assertEquals(deck.getMaxCards(),6);
}
@Test
public void testGetCards(){
assertEquals(deck.getCards(),new ArrayList<>());
} }
@Test
public void testGetPlayedCards(){
assertEquals(deck.getPlayedCards(),new ArrayList<>());
}
@Test
public void testclear(){
deck.clear();
assertEquals(deck.getPlayedCards(),new ArrayList<>());
}
@Test @Test
void testAddCard() { void testAddCard() {
assertTrue(deck.add(card)); assertTrue(deck.add(card));
} }
@Test @Test
void testAddList() { void testAddList() {
cardList.add(card);
assertTrue(deck.add(cardList)); assertTrue(deck.add(cardList));
} }
@Test @Test
void playCard() { void testRemoveCard() {
deck.add(card);
deck.remove(card);
assertFalse(deck.getCards().contains(card));
}
@Test
void testRemoveList() {
cardList.add(card); cardList.add(card);
PlayerCard testcard = deck.playCard(card); deck.add(cardList);
assertEquals(card.getPhase(),testcard.getPhase()); deck.remove(cardList);
assertEquals(card.getCardName(),testcard.getCardName()); assertFalse(deck.getCards().containsAll(cardList));
assertEquals(card.getDescription(),testcard.getDescription()); }
assertEquals(card.getName(),testcard.getName());
@Test
void playCard() {
deck.add(card);
assertTrue(deck.play(card));
} }
@Test @Test
void playCards() { void playCards() {
cardList.add(card); cardList.add(card);
boolean result = deck.add(card); deck.add(cardList);
List<Card> testCardList = deck.playCards(cardList); assertTrue(deck.play(cardList));
assertTrue(testCardList.contains(card)); }
@Test
public void testHandSize(){
assertEquals(0,deck.handSize());
}
@Test
public void testHandEmpty(){
assertTrue(deck.handIsEmpty());
}
@Test
public void testPlayedCardSize(){
assertEquals(0,deck.playedCardSize());
}
@Test
public void testPlayedCardIsEmpty(){
assertTrue(deck.playedCardIsEmpty());
} }
*/
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment