View Javadoc
1   /******************************************************************************
2    * TestRatingGraphConfig.java - Test the RatingGraphConfig 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/05/07 06:20:55  dick
10   * Test the rest of the domain package.
11   *
12   */
13  
14  /* 
15   * This program is free software: you can redistribute it and/or modify
16   * it under the terms of the GNU General Public License as published by
17   * the Free Software Foundation, either version 3 of the License, or
18   * (at your option) any later version.
19   *
20   * This program is distributed in the hope that it will be useful,
21   * but WITHOUT ANY WARRANTY; without even the implied warranty of
22   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23   * GNU General Public License for more details.
24   *
25   * You should have received a copy of the GNU General Public License
26   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
27   *
28   * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>.
29   * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp.
30   * 
31   */
32  package com.buckosoft.fibs.domain.config;
33  
34  import java.util.Date;
35  
36  import junit.framework.TestCase;
37  
38  import org.junit.Before;
39  import org.junit.Test;
40  
41  import com.buckosoft.fibs.domain.config.RatingGraphConfig;
42  
43  public class TestRatingGraphConfig extends TestCase {
44  	private RatingGraphConfig rgc;
45  
46  	@Before
47  	public void setUp() throws Exception {
48  		rgc = new RatingGraphConfig();
49  	}
50  
51  	@Test
52  	public void testGetType() {
53  		rgc.setType(RatingGraphConfig.Type.displayAllMatches);
54  		assertEquals(RatingGraphConfig.Type.displayAllMatches, rgc.getType());
55  	}
56  
57  	@Test
58  	public void testSetType() {
59  		rgc.setType(RatingGraphConfig.Type.displayFromDate);
60  		assertEquals(RatingGraphConfig.Type.displayFromDate, rgc.getType());
61  	}
62  
63  	@Test
64  	public void testSetTypeAsInt() {
65  		rgc.setTypeAsInt(0);
66  		assertEquals(0, rgc.getTypeAsInt());
67  		rgc.setTypeAsInt(1);
68  		assertEquals(1, rgc.getTypeAsInt());
69  		rgc.setTypeAsInt(2);
70  		assertEquals(2, rgc.getTypeAsInt());
71  	}
72  
73  	@Test
74  	public void testGetTypeAsInt() {
75  		rgc.setTypeAsInt(0);
76  		assertEquals(0, rgc.getTypeAsInt());
77  		rgc.setTypeAsInt(1);
78  		assertEquals(1, rgc.getTypeAsInt());
79  		rgc.setTypeAsInt(2);
80  		assertEquals(2, rgc.getTypeAsInt());
81  	}
82  
83  	@Test
84  	public void testGetMatchCount() {
85  		rgc.setMatchCount(0);
86  		assertEquals(0, rgc.getMatchCount());
87  		rgc.setMatchCount(5);
88  		assertEquals(5, rgc.getMatchCount());
89  	}
90  
91  	@Test
92  	public void testSetMatchCount() {
93  		rgc.setMatchCount(3);
94  		assertEquals(3, rgc.getMatchCount());
95  		rgc.setMatchCount(6);
96  		assertEquals(6, rgc.getMatchCount());
97  	}
98  
99  	@Test
100 	public void testGetFirstMatchDate() {
101 		Date d = new Date();
102 		rgc.setFirstMatchDate(d);
103 		assertEquals(d.getTime(), rgc.getFirstMatchDate().getTime());
104 	}
105 
106 	@Test
107 	public void testSetFirstMatchDate() {
108 		Date d = new Date();
109 		rgc.setFirstMatchDate(d);
110 		assertEquals(d.getTime(), rgc.getFirstMatchDate().getTime());
111 	}
112 
113 	@Test
114 	public void testClone() {
115 		RatingGraphConfig rgc1 = rgc.clone();
116 		assertEquals(rgc.getType(), rgc1.getType());
117 		assertEquals(rgc.getMatchCount(), rgc1.getMatchCount());
118 		assertEquals(rgc.getFirstMatchDate(), rgc1.getFirstMatchDate());
119 	}
120 
121 }