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

    @Test
    void getIcon() {
        Hunter h = new Hunter(1, true);

        assertTrue(h.getIcon());
    }

    @Test
    void testToString() {
        Hunter h = new Hunter(1, true);
        String s = h.toString();

        assertNotNull(s);
        assertTrue(s.contains(CharacterType.HUNTER.toString()));
        assertTrue(s.contains("Icon: true"));
    }

    @Test
    void testClone() {
        Hunter h = new Hunter(1, true, 3);
        Hunter clone = (Hunter) h.clone();

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

    @Test
    void insert() {
        Player p = new Player("test");
        Hunter h = new Hunter(1, true);

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

        h.insert(p);

        assertEquals(1, p.hunters.size());
        assertTrue(p.hunters.contains(h));

        Hunter h2 = new Hunter(1, false);
        h2.insert(p);

        assertEquals(2, p.hunters.size());
        assertTrue(p.hunters.contains(h2));
    }

    @Test
    void constructorTest() {
        Hunter h = new Hunter(1, true);

        assertEquals(1, h.getEra());
        assertEquals(CharacterType.HUNTER, h.getType());
        assertTrue(h.getIcon());
        assertEquals(0, h.getNMin());
        assertFalse(h.IsEventCard());
    }

    @Test
    void constructorWithNMinTest() {
        Hunter h = new Hunter(1, false, 3);

        assertEquals(1, h.getEra());
        assertEquals(CharacterType.HUNTER, h.getType());
        assertFalse(h.getIcon());
        assertEquals(3, h.getNMin());
        assertFalse(h.IsEventCard());
    }
}