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

    @Test
    void testToString() {
        Artist a = new Artist(1);
        String s = a.toString();

        assertNotNull(s);
        assertTrue(s.contains(CharacterType.ARTIST.toString()));
    }

    @Test
    void testClone() {
        Artist a = new Artist(1, 3);
        Artist clone = (Artist) a.clone();

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

    @Test
    void insert() {
        Player p = new Player("test");
        Artist a = new Artist(1);

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

        a.insert(p);

        assertEquals(1, p.artists.size());
        assertTrue(p.artists.contains(a));

        Artist a2 = new Artist(1);
        a2.insert(p);

        assertEquals(2, p.artists.size());
        assertTrue(p.artists.contains(a2));
    }

    @Test
    void constructorTest() {
        Artist a = new Artist(1);

        assertEquals(1, a.getEra());
        assertEquals(CharacterType.ARTIST, a.getType());
        assertEquals(0, a.getNMin());
        assertFalse(a.IsEventCard());
    }

    @Test
    void constructorWithNMinTest() {
        Artist a = new Artist(1, 3);

        assertEquals(1, a.getEra());
        assertEquals(CharacterType.ARTIST, a.getType());
        assertEquals(3, a.getNMin());
        assertFalse(a.IsEventCard());
    }


}