/*
 * Copyright (c) 2015 Justin White <jw@justinwhite.net>
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 *  3. Neither the name of the copyright holder nor the names of its
 *  contributors may be used to endorse or promote products derived from this
 *  software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY OF SUCH DAMAGE.
 */

package net.justinwhite.score_model.phase_10;

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

import static org.junit.Assert.assertEquals;

@SuppressWarnings("FieldCanBeLocal")
public class Phase10PlayerTest {
    private final String name = "Test Phase10Player";
    private final int score = 11;
    private final int phase = 1;
    private Phase10Game game;
    private Phase10Player player;

    @Before
    public void setUp() {
        game = new Phase10Game();
        player = new Phase10Player(game, name);
        player.addScore(score);
        player.completePhase();
    }

    @Test
    public void testPhase10Player() throws Exception {

    }

    @Test
    public void testToString() throws Exception {
        assertEquals(String.format(
                        "Name '%s'; Score %s; Phase %d",
                        name,
                        score,
                        phase
                ), player.toString()
        );
    }

    @Test
    public void testCompletePhase() throws Exception {
        player.completePhase();
        assertEquals(phase + 1, player.getPhase());
    }

}

@@ -1747,16 +1747,59 @@
 tEquals;
+%0Aimport static org.junit.Assert.assertNull;
 %0A%0A@Suppr
@@ -2083,16 +2083,33 @@
  setUp()
+ throws Exception
  %7B%0A     
@@ -2176,14 +2176,102 @@
 yer(
-game, 
+);%0A        assertNull(player.getGame());%0A        player.setGame(game);%0A        player.setName(
 name
@@ -2413,380 +2413,1348 @@
 n %7B%0A
-%0A    %7D%0A%0A    @Test%0A    public void testToString() throws Exception %7B%0A        assertEquals(String.format(%0A                        %22Name '%25s'; Score %25s; Phase %25d%22,%0A                        name,%0A                        score,%0A                        phase%0A                ), player.toString()%0A        );%0A    %7D%0A%0A    @Test%0A    public void testCompletePhase() throws Exception %7B%0A
+        game = new Phase10Game(2, Phase10Game.PHASES_EVEN);%0A        player = new Phase10Player(game);%0A        player.setName(name);%0A        player.completePhase();%0A        assertEquals(2, player.getPhase());%0A        player.completePhase();%0A        assertEquals(4, player.getPhase());%0A        game = new Phase10Game(2, Phase10Game.PHASES_ODD);%0A        player = new Phase10Player(game, name);%0A        player.completePhase();%0A        assertEquals(1, player.getPhase());%0A        player.completePhase();%0A        assertEquals(3, player.getPhase());%0A    %7D%0A%0A    @Test%0A    public void testToString() throws Exception %7B%0A        assertEquals(String.format(%0A                        %22Name '%25s'; Score %25s; Phase %25d%22,%0A                        name,%0A                        score,%0A                        phase%0A                ), player.toString()%0A        );%0A    %7D%0A%0A    @Test%0A    public void testGame() %7B%0A        assertEquals(game, player.getGame());%0A    %7D%0A%0A    @Test%0A    public void testName() %7B%0A        assertEquals(name, player.getName());%0A    %7D%0A%0A    @Test%0A    public void testScore() %7B%0A        assertEquals(score, player.getScore());%0A        player.addScore(score);%0A        assertEquals(score * 2, player.getScore());%0A    %7D%0A%0A    @Test%0A    public void testPhase() throws Exception %7B%0A        for (int i = phase + 1; i %3C= Phase10Game.MAX_PHASE; i++) %7B%0A    
     
@@ -3781,32 +3781,36 @@
 hase();%0A        
+ 
+   
 assertEquals(pha
@@ -3806,25 +3806,205 @@
 tEquals(
-phase + 1
+i, player.getPhase());%0A        %7D%0A        assertEquals(game.MAX_PHASE, player.getPhase());%0A        player.completePhase();%0A        player.completePhase();%0A        assertEquals(game.MAX_PHASE
 , player

Add Phase10Player tests for full coverage.