SWE1-MTCG/src/test/java/StackTest.java

48 lines
1.4 KiB
Java

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class StackTest {
private Cards newCards, cards, nochNewCards;
private Card newCard, card;
private ArrayList<Card> cardsArrayList, cardsArrayList2, cardsArrayList3;
private Stack stack;
@BeforeEach
void setUp() {
card = new Card("Name", 10, ElementTyp.WATER, CardType.MONSTER);
newCard = new Card("NameNew", 10, ElementTyp.WATER, CardType.SPELL);
cardsArrayList = new ArrayList<Card>();
cardsArrayList2 = new ArrayList<Card>();
cardsArrayList3 = new ArrayList<Card>();
cardsArrayList.add(card);
cardsArrayList2.add(newCard);
cardsArrayList2.add(card);
cards = new Cards(cardsArrayList);
newCards = new Cards(cardsArrayList2);
nochNewCards = new Cards(cardsArrayList3);
stack = new Stack(cards, nochNewCards);
}
@Test
void test_addDeck() {
stack.addDeck(newCards);
Cards result = stack.getDeck();
assertTrue(result.equals(newCards));
}
@Test
void test_delDeck() {
stack.addDeck(newCards);
stack.delDeck(newCard);
assertTrue(stack.getDeck().equals(cards));
}
@Test
void test_getDeck() {
Cards result = stack.getDeck();
assertTrue(result.equals(cards));
}
}