package jrummikub.model;

import static org.junit.Assert.*;

import java.awt.Color;

import org.junit.Before;
import org.junit.Test;

/**
 * Test class for {@link RoundState}
 */
public class RoundStateTest {
	private GameSettings settings = new GameSettings();
	private IRoundState testRound;

	/** */
	@Before
	public void createRound() {
		settings.getPlayerList().add(new PlayerSettings("Player 1", Color.RED));
		settings.getPlayerList().add(new PlayerSettings("Player 2", Color.YELLOW));
		settings.getPlayerList().add(new PlayerSettings("Player 3", Color.BLUE));

		testRound = new RoundState(settings, null);
	}

	/** */
	@Test
	public void nextActiveTest() {
		// All there?
		assertEquals(settings.getPlayerList().size(), testRound.getPlayerCount());
		assertSame(Color.RED, testRound.getActivePlayer().getPlayerSettings()
				.getColor());
		testRound.nextPlayer();
		assertSame(Color.YELLOW, testRound.getActivePlayer().getPlayerSettings()
				.getColor());
		testRound.nextPlayer();
		testRound.nextPlayer();
		assertSame(Color.RED, testRound.getActivePlayer().getPlayerSettings()
				.getColor());
	}

}
