package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters;

import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
import it.polimi.ingsw.gc14.Model.Player;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class ShamanTest {

    @Test
    void getIcon() {
        Shaman s = new Shaman(1, 4);

        assertEquals(4, s.getIcon());
    }

    @Test
    void testToString() {
        Shaman s = new Shaman(1, 4);
        String str = s.toString();

        assertNotNull(str);
        assertTrue(str.contains(CharacterType.SHAMAN.toString()));
        assertTrue(str.contains("Icon: 4"));
    }

    @Test
    void testClone() {
        Shaman s = new Shaman(1, 4, 3);
        Shaman clone = (Shaman) s.clone();

        assertNotNull(clone);
        assertNotSame(s, clone);
        assertEquals(s.getEra(), clone.getEra());
        assertEquals(s.getType(), clone.getType());
        assertEquals(s.getIcon(), clone.getIcon());
        assertEquals(s.getNMin(), clone.getNMin());
    }

    @Test
    void insert() {
        Player p = new Player("test");
        Shaman s = new Shaman(1, 4);

        assertEquals(0, p.shamans.size());

        s.insert(p);

        assertEquals(1, p.shamans.size());
        assertTrue(p.shamans.contains(s));

        Shaman s2 = new Shaman(1, 6);
        s2.insert(p);

        assertEquals(2, p.shamans.size());
        assertTrue(p.shamans.contains(s2));
    }

    @Test
    void constructorTest() {
        Shaman s = new Shaman(1, 4);

        assertEquals(1, s.getEra());
        assertEquals(CharacterType.SHAMAN, s.getType());
        assertEquals(4, s.getIcon());
        assertEquals(0, s.getNMin());
        assertFalse(s.IsEventCard());
    }

    @Test
    void constructorWithNMinTest() {
        Shaman s = new Shaman(1, 4, 3);

        assertEquals(1, s.getEra());
        assertEquals(CharacterType.SHAMAN, s.getType());
        assertEquals(4, s.getIcon());
        assertEquals(3, s.getNMin());
        assertFalse(s.IsEventCard());
    }
}