package eu.jonahbauer.wizard.core.states;

import org.junit.jupiter.api.Test;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class GameStateTest {

    @Test
    public void getNextPlayer_IsPermutation() {
        List<UUID> players = List.of(
                new UUID(0, 1),
                new UUID(0, 2),
                new UUID(0, 3),
                new UUID(0, 4),
                new UUID(0, 5),
                new UUID(0, 6)
        );

        GameState gameState = mock(GameState.class);
        when(gameState.getNextPlayer(any())).thenCallRealMethod();
        when(gameState.get(GameData.PLAYERS)).thenReturn(players);

        Set<UUID> a = new HashSet<>(players);
        Set<UUID> b = new HashSet<>();

        a.forEach(player -> b.add(gameState.getNextPlayer(player)));

        assertEquals(a, b);
    }
}
