View Javadoc
1   /******************************************************************************
2    * TestGameLine.java - Test the GameLine domain object.
3    * $Id$
4    * 
5    * BuckoFIBS - Backgammon by BuckoSoft
6    * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp.
7    * 
8    * $Log$
9    * Revision 1.1  2011/06/15 04:00:40  dick
10   * TestGameBoard becomes TestGameEventBoard.
11   *
12   * Revision 1.2  2011/05/22 05:09:01  dick
13   * All GameEvent objects are named starting with GameEvent.
14   *
15   * Revision 1.1  2011/05/21 16:16:46  dick
16   * TestGameLine becomes TestGameBoard.
17   *
18   * Revision 1.2  2011/05/15 02:20:12  dick
19   * Move a whole bunch of packages around.
20   *
21   * Revision 1.1  2011/05/11 22:24:41  dick
22   * TestLine becomes TestGameLine.
23   *
24   * Revision 1.3  2011/05/07 15:12:27  dick
25   * Javadoc fix.
26   *
27   * Revision 1.2  2011/05/07 14:05:41  dick
28   * Javadoc
29   *
30   * Revision 1.1  2011/05/07 06:20:54  dick
31   * Test the rest of the domain package.
32   *
33   */
34  
35  /* 
36   * This program is free software: you can redistribute it and/or modify
37   * it under the terms of the GNU General Public License as published by
38   * the Free Software Foundation, either version 3 of the License, or
39   * (at your option) any later version.
40   *
41   * This program is distributed in the hope that it will be useful,
42   * but WITHOUT ANY WARRANTY; without even the implied warranty of
43   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44   * GNU General Public License for more details.
45   *
46   * You should have received a copy of the GNU General Public License
47   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
48   *
49   * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>.
50   * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp.
51   * 
52   */
53  package com.buckosoft.fibs.domain.gameEvent;
54  
55  import junit.framework.TestCase;
56  
57  import org.junit.Before;
58  import org.junit.Test;
59  
60  import com.buckosoft.fibs.domain.gameEvent.GameEventBoard;
61  import com.buckosoft.fibs.domain.gameEvent.GameEventRoll;
62  import com.buckosoft.fibs.domain.gameEvent.GameEvent.Life;
63  import com.buckosoft.fibs.domain.gameEvent.GameEvent.Type;
64  
65  /** Test the GameLine domain object.
66   * @author dick
67   * @since 2011/05/06
68   * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/test/java/com/buckosoft/fibs/test/domain/gameEvent/TestGameEventBoard.java">cvs TestGameEventBoard.java</a>
69   *
70   */
71  public class TestGameEventBoard extends TestCase {
72  	private GameEventBoard geb;
73  	private String fibsBoard = "board:You:someplayer:3:0:0:1:-2:0:0:0:0:5:0:3:0:0:0:-5:5:0:0:0:-3:0:-5:0:0:0:0:2:2:1:4:4:0:0:1:1:1:0:1:-1:0:25:0:0:0:0:2:0:0:0";
74  
75  	@Before
76  	public void setUp() throws Exception {
77  		geb = new GameEventBoard();
78  	}
79  
80  	@Test
81  	public void testGameEventBoard() {
82  		geb = new GameEventBoard(fibsBoard);
83  		assertEquals(Type.Board, geb.getType());
84  		assertEquals(Life.Persistent, geb.getLife());
85  		assertNotNull(geb.getBoard());
86  		assertEquals("You", geb.getBoard().getPlayerName()[0]);
87  		assertNull(geb.getPostEvent());
88  		GameEventRoll ger = new GameEventRoll();
89  		geb.setPostEvent(ger);
90  		assertEquals(ger, geb.getPostEvent());
91  		assertEquals("board:You:someplayer", geb.toString());
92  	}
93  
94  	@Test
95  	public void testGetCheckersToMove() {
96  		geb.setCheckersToMove(2);
97  		assertEquals(2, geb.getCheckersToMove());
98  	}
99  
100 	@Test
101 	public void testSetCheckersToMove() {
102 		geb.setCheckersToMove(2);
103 		assertEquals(2, geb.getCheckersToMove());
104 	}
105 
106 }