1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
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  
29  
30  
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  
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 }