View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.bo;
17  
18  
19  
20  import java.util.LinkedHashMap;
21  
22  import org.junit.Test;
23  import org.kuali.rice.kns.bo.CountryImpl;
24  import org.kuali.test.KNSTestCase;
25  
26  
27  /**
28   * This class tests CountryImp.java on org.kuali.rice.kns.bo 
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   *
32   */
33  public class CountryImplTest extends KNSTestCase{
34  
35  	CountryImpl dummyCountryOne;
36  	CountryImpl dummyCountrytwo;
37  
38  	
39  	@Override
40  	public void setUp() throws Exception {
41  		super.setUp();
42  		dummyCountryOne = new CountryImpl();
43  		dummyCountrytwo = new CountryImpl();
44  	}
45  
46  	
47  	@Override
48  	public void tearDown() throws Exception {
49  		super.tearDown();
50  		dummyCountryOne = null;
51  		dummyCountrytwo = null;
52  	}
53  	
54  	@Test
55  	public void testPostalCountryCode(){
56  		dummyCountryOne.setPostalCountryCode("USA");
57  		
58  		assertEquals("Testing set and get PostalCountryCode for USA", "USA",dummyCountryOne.getPostalCountryCode());
59  		assertNull("Testing should get null ",dummyCountrytwo.getPostalCountryCode());
60  	}
61  	
62  	@Test
63  	public void testAlternatePostalCountryCode(){
64  		dummyCountryOne.setAlternatePostalCountryCode("USA");
65  		
66  		assertEquals("Testing set and get AlternatePostalCountryCode for USA", "USA",dummyCountryOne.getAlternatePostalCountryCode());
67  		assertNull("Testing should get null ",dummyCountrytwo.getAlternatePostalCountryCode());
68  	}
69  	
70  	@Test
71  	public void testPostalCountryName(){
72  		dummyCountryOne.setPostalCountryName("America");
73  		
74  		assertEquals("Testing set and get PostalCountryName for Amercia", "America",dummyCountryOne.getPostalCountryName());
75  		assertNull("Testing should get null ", dummyCountrytwo.getPostalCountryName());
76  	}
77  
78  	
79  	/**
80  	 * boolean default is set to false
81  	 */
82  	
83  	@Test
84  	public void testPostalCountryRestrictedIndicator(){
85  		dummyCountryOne.setPostalCountryRestrictedIndicator(true);
86  			
87  		assertTrue("Testing set and check PostalCountryRestrictedIndicator ",dummyCountryOne.isPostalCountryRestrictedIndicator());
88  		assertFalse("Testing get should get default PostalCountryRestrictedIndicator vaue",dummyCountrytwo.isPostalCountryRestrictedIndicator());
89  	}
90  
91  	@Test
92  	public void testActive(){
93  		dummyCountryOne.setActive(true);
94  			
95  		assertTrue("Testing set and check Active ",dummyCountryOne.isActive());
96  		assertFalse("Testing get should get default Active",dummyCountrytwo.isActive());
97  	}
98  	
99  	@Test
100 	public void testToStringMapper(){
101 		dummyCountryOne.setPostalCountryCode("US1101");
102 		LinkedHashMap dummyMap =  dummyCountryOne.toStringMapper();
103 		assertEquals("Testing toStringMapper of CountryImpl",dummyCountryOne.getPostalCountryCode() , dummyMap.get("postalCountryCode"));
104 	}
105 
106 }