36 lines
1.2 KiB
Java
36 lines
1.2 KiB
Java
package Server.Cards;
|
|
|
|
import Server.Utils.LoadingCardsException;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static Server.Era.I;
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class CharacterCardTest {
|
|
|
|
//Test if the method parsRow is able to create a correct CharacterCard
|
|
@Test
|
|
void parsRow() {
|
|
CharacterCard characterCard = CharacterCard.parsRow("C;1;2;I;SHAMAN;3;4");
|
|
|
|
assertEquals(1, characterCard.getCardId());
|
|
assertEquals(2, characterCard.getForMinPlayer());
|
|
assertEquals(I, characterCard.getEra());
|
|
assertEquals(CharacterType.SHAMAN, characterCard.getCharacterType());
|
|
assertEquals(3, characterCard.getIconValue());
|
|
assertEquals(4, characterCard.getPrestigePoints());
|
|
}
|
|
|
|
//Tests if the method parsRow send an exception with the message "Not a character" when is given
|
|
//as an input the wrong type of card
|
|
|
|
@Test
|
|
void wrongTypeOfCard(){
|
|
Exception exception = assertThrows(LoadingCardsException.class, () -> CharacterCard.parsRow("B;1;2;I;3;1;SHAMANIC_RITUAL"));
|
|
|
|
String actualMessage = exception.getMessage();
|
|
assertTrue(actualMessage.contains("Not a character card"));
|
|
|
|
}
|
|
|
|
} |