View Javadoc
1   /******************************************************************************
2    * TestPlayerGroup.java - Test the backgammon board 
3    * $Id$
4    * 
5    * BuckoFIBS - Backgammon by BuckoSoft
6    * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp.
7    * 
8    * $Log$
9    * Revision 1.2  2011/05/10 05:49:33  dick
10   * setTagForDelete() doesn't need a parameter.  It is always true.
11   *
12   * Revision 1.1  2011/05/07 06:20:55  dick
13   * Test the rest of the domain package.
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;
36  
37  import junit.framework.TestCase;
38  
39  import org.junit.Before;
40  import org.junit.Test;
41  
42  import com.buckosoft.fibs.domain.PlayerGroup;
43  
44  public class TestPlayerGroup extends TestCase {
45  	private PlayerGroup pg = null;
46  
47  	@Before
48  	public void setUp() throws Exception {
49  		pg = new PlayerGroup();
50  	}
51  
52  	@Test
53  	public void testPlayerGroup() {
54  		assertNotNull(new PlayerGroup());
55  	}
56  
57  	@Test
58  	public void testPlayerGroupIntInt() {
59  		pg = new PlayerGroup(1,2);
60  		assertEquals(1, pg.getGroupId());
61  		assertEquals(2, pg.getPlayerId());
62  	}
63  
64  	@Test
65  	public void testGetId() {
66  		pg.setId(69);
67  		assertEquals(69, pg.getId());
68  	}
69  
70  	@Test
71  	public void testSetId() {
72  		pg.setId(45);
73  		assertEquals(45, pg.getId());
74  	}
75  
76  	@Test
77  	public void testGetGroupId() {
78  		pg = new PlayerGroup(12,45);
79  		assertEquals(12, pg.getGroupId());
80  	}
81  
82  	@Test
83  	public void testSetGroupId() {
84  		pg.setGroupId(98);
85  		assertEquals(98, pg.getGroupId());
86  	}
87  
88  	@Test
89  	public void testGetPlayerId() {
90  		pg = new PlayerGroup(99,88);
91  		assertEquals(88, pg.getPlayerId());
92  	}
93  
94  	@Test
95  	public void testSetPlayerId() {
96  		pg.setPlayerId(123);
97  		assertEquals(123, pg.getPlayerId());
98  	}
99  
100 	@Test
101 	public void testIsDirty() {
102 		pg.setDirty(false);
103 		assertFalse(pg.isDirty());
104 		pg.setDirty(true);
105 		assertTrue(pg.isDirty());
106 	}
107 
108 	@Test
109 	public void testSetDirty() {
110 		pg.setDirty(false);
111 		assertFalse(pg.isDirty());
112 		pg.setDirty(true);
113 		assertTrue(pg.isDirty());
114 	}
115 
116 	@Test
117 	public void testTagForDelete() {
118 		pg.setTagForDelete();
119 		assertTrue(pg.isTagForDelete());
120 		assertTrue(pg.isDirty());
121 	}
122 }