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

50 lines
1.4 KiB
Java

import at.reisinger.*;
import at.reisinger.Package;
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 PackageTest {
private Cards newCards, cards, nochNewCards;
private Card newCard, card;
private ArrayList<Card> cardsArrayList, cardsArrayList2, cardsArrayList3;
private Package myPackage;
@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);
cards = new Cards(cardsArrayList);
newCards = new Cards(cardsArrayList2);
nochNewCards = new Cards(cardsArrayList3);
myPackage = new Package(cards,"Name", 100);
}
@Test
void test_getName() {
String result = myPackage.getName();
assertTrue(result.equals("Name"));
}
@Test
void test_getPrice() {
int result = myPackage.getPrice();
assertTrue(result==100);
}
@Test
void test_setName() {
myPackage.setName("neuName");
String result = myPackage.getName();
assertTrue(result.equals("neuName"));
}
}