View Javadoc
1   /******************************************************************************
2    * TestGameEvent.java - Test the GameEvent base class.
3    * $Id$
4    * 
5    * BuckoFIBS - Backgammon by BuckoSoft
6    * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp.
7    * 
8    * $Log$
9    * Revision 1.2  2011/06/15 02:57:46  dick
10   * Finish GameEvent tests.
11   *
12   * Revision 1.1  2011/06/14 23:31:29  dick
13   * Add the TestGameEvent test.
14   *
15   */
16  
17  /* 
18   * This program is free software: you can redistribute it and/or modify
19   * it under the terms of the GNU General Public License as published by
20   * the Free Software Foundation, either version 3 of the License, or
21   * (at your option) any later version.
22   *
23   * This program is distributed in the hope that it will be useful,
24   * but WITHOUT ANY WARRANTY; without even the implied warranty of
25   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26   * GNU General Public License for more details.
27   *
28   * You should have received a copy of the GNU General Public License
29   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
30   *
31   * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>.
32   * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp.
33   * 
34   */
35  package com.buckosoft.fibs.domain.gameEvent;
36  
37  import junit.framework.TestCase;
38  
39  import org.junit.Before;
40  import org.junit.Test;
41  
42  import com.buckosoft.fibs.domain.Board;
43  import com.buckosoft.fibs.domain.gameEvent.GameEventMove;
44  import com.buckosoft.fibs.domain.gameEvent.GameEvent.Life;
45  import com.buckosoft.fibs.domain.gameEvent.GameEvent.Type;
46  
47  /** Test the {@link com.buckosoft.fibs.domain.gameEvent.TestGameEvent} base class
48   * @author Dick Balaska
49   * @since 2011/06/13
50   * @version $Revision$ <br> $Date$
51   * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/test/java/com/buckosoft/fibs/test/domain/gameEvent/TestGameEvent.java">cvs TestGameEvent.java</a>
52   */
53  public class TestGameEvent extends TestCase {
54  
55  	/**
56  	 * @throws java.lang.Exception
57  	 */
58  	@Before
59  	public void setUp() throws Exception {
60  	}
61  
62  	@Test
63  	public void testGameEvent() {
64  		GameEventMove gm = new GameEventMove();
65  		assertEquals(Life.Persistent, gm.getLife());
66  		gm.setDirection(-1);
67  		assertEquals(Type.Move,  gm.getType());
68  		gm.setWho(Board.X);
69  		assertEquals(Board.X, gm.getWho());
70  		assertEquals(1, gm.getDepth());
71  		gm.setWho(Board.O);
72  		assertEquals(Board.O, gm.getWho());
73  		assertEquals(-1, gm.getDepth());
74  		gm.setPlayerName("Bob");
75  		assertEquals("Bob", gm.getPlayerName());
76  	}
77  }