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 EventCardTest {

    //Test if the method parsRow is able to create a correct EventCard
    @Test
    void parsRow() {
        EventCard eventCard = EventCard.parsRow("E;1;2;I;CAVE_PAINTINGS;3;4");

        assertEquals(1, eventCard.getCardId());
        assertEquals(2, eventCard.getForMinPlayer());
        assertEquals(I, eventCard.getEra());
        assertEquals(Event.CAVE_PAINTINGS, eventCard.getEvent());
        assertEquals(3, eventCard.getFirstValue());
        assertEquals(4, eventCard.getSecondValue());
    }

    //Tests if the method parsRow send an exception with the message "Not an EventCard" when is given
    //as an input the wrong type of card

    @Test
    void wrongTypeOfCard(){
        Exception exception = assertThrows(LoadingCardsException.class, () -> EventCard.parsRow("B;1;2;I;3;1;SHAMANIC_RITUAL"));

        String actualMessage = exception.getMessage();
        assertTrue(actualMessage.contains("Not an EventCard"));
    }
}