Clover Coverage Report - Kuali Student 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 05:03:32 EDT
170   443   30   5.67
0   298   0.18   30
30     1  
1    
Warning
  • The source file used to generate this report was changed after Clover generated coverage information. The coverage reported may not match the source lines. You should regenerate the coverage information and the report to ensure the files are in sync.
 
  TestIdentityServiceMockImpl       Line # 49 170 0% 30 0 100% 1.0
 
  (25)
 
1    /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5    package org.kuali.student.kim.identity.mock;
6   
7    import static org.junit.Assert.assertEquals;
8    import static org.junit.Assert.assertNull;
9   
10    import java.util.Arrays;
11    import java.util.HashMap;
12    import java.util.List;
13    import java.util.Map;
14   
15    import org.junit.After;
16    import org.junit.AfterClass;
17    import org.junit.Before;
18    import org.junit.BeforeClass;
19    import org.junit.Test;
20    import org.kuali.rice.kim.bo.entity.dto.KimEntityDefaultInfo;
21    import org.kuali.rice.kim.bo.entity.dto.KimEntityInfo;
22    import org.kuali.rice.kim.bo.entity.dto.KimEntityPrivacyPreferencesInfo;
23    import org.kuali.rice.kim.bo.entity.dto.KimPrincipalInfo;
24    import org.kuali.rice.kim.bo.reference.dto.AddressTypeInfo;
25    import org.kuali.rice.kim.bo.reference.dto.AffiliationTypeInfo;
26    import org.kuali.rice.kim.bo.reference.dto.EmailTypeInfo;
27    import org.kuali.rice.kim.bo.reference.dto.EmploymentStatusInfo;
28    import org.kuali.rice.kim.bo.reference.dto.EmploymentTypeInfo;
29    import org.kuali.rice.kim.bo.reference.dto.EntityNameTypeInfo;
30    import org.kuali.rice.kim.bo.reference.dto.EntityTypeInfo;
31    import org.kuali.rice.kim.bo.reference.dto.ExternalIdentifierTypeInfo;
32    import org.kuali.rice.kim.bo.reference.dto.PhoneTypeInfo;
33    import org.kuali.student.kim.identity.mock.AddressTypeEnum;
34    import org.kuali.student.kim.identity.mock.AffiliationTypeEnum;
35    import org.kuali.student.kim.identity.mock.EmailTypeEnum;
36    import org.kuali.student.kim.identity.mock.EmployeeStatusEnum;
37    import org.kuali.student.kim.identity.mock.EmployeeTypeEnum;
38    import org.kuali.student.kim.identity.mock.EntityNameTypeEnum;
39    import org.kuali.student.kim.identity.mock.EntityTypeEnum;
40    import org.kuali.student.kim.identity.mock.ExternalIdentifierTypeEnum;
41    import org.kuali.student.kim.identity.mock.IdentityServiceConstants;
42    import org.kuali.student.kim.identity.mock.PersonEnum;
43    import org.kuali.student.kim.identity.mock.PhoneTypeEnum;
44   
45    /**
46    *
47    * @author nwright
48    */
 
49    public class TestIdentityServiceMockImpl {
50   
 
51  25 toggle public TestIdentityServiceMockImpl() {
52    }
53   
 
54  1 toggle @BeforeClass
55    public static void setUpClass() throws Exception {
56    }
57   
 
58  1 toggle @AfterClass
59    public static void tearDownClass() throws Exception {
60    }
61   
 
62  25 toggle @Before
63    public void setUp() {
64    }
65   
 
66  25 toggle @After
67    public void tearDown() {
68    }
69   
70    /**
71    * Test of getAddressType method, of class MockIdentityServiceImpl.
72    */
 
73  1 toggle @Test
74    public void testGetAddressType() {
75  1
76  1 String code = AddressTypeEnum.HOME.getCode();
77  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
78  1 AddressTypeInfo result = instance.getAddressType(code);
79  1 assertEquals(code, result.getCode());
80    }
81   
82    /**
83    * Test of getAffiliationType method, of class MockIdentityServiceImpl.
84    */
 
85  1 toggle @Test
86    public void testGetAffiliationType() {
87  1
88  1 String code = AffiliationTypeEnum.STAFF.getCode();
89  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
90  1 AffiliationTypeInfo result = instance.getAffiliationType(code);
91  1 assertEquals(code, result.getCode());
92   
93    }
94   
95    /**
96    * Test of getCitizenshipStatus method, of class MockIdentityServiceImpl.
97    */
 
98  1 toggle @Test
99    public void testGetCitizenshipStatus() {
100  1
101    // String code = "";
102    // MockIdentityServiceImpl instance = new MockIdentityServiceImpl();
103    // CitizenshipStatusInfo expResult = null;
104    // CitizenshipStatusInfo result = instance.getCitizenshipStatus(code);
105    // assertEquals(expResult, result);
106    }
107   
108    /**
109    * Test of getDefaultNamesForEntityIds method, of class MockIdentityServiceImpl.
110    */
 
111  1 toggle @Test
112    public void testGetDefaultNamesForEntityIds() {
113  1
114  1 List<String> entityIds = Arrays.asList(PersonEnum.STAFF1.getEntityId(), PersonEnum.STUDENT10.getEntityId());
115  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
116  1 Map result = instance.getDefaultNamesForEntityIds(entityIds);
117  1 assertEquals(2, result.size());
118    }
119   
120    /**
121    * Test of getDefaultNamesForPrincipalIds method, of class MockIdentityServiceImpl.
122    */
 
123  1 toggle @Test
124    public void testGetDefaultNamesForPrincipalIds() {
125  1
126  1 List<String> principalIds = Arrays.asList(PersonEnum.STAFF1.getPrincipalId(), PersonEnum.STUDENT10.getPrincipalId());
127  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
128  1 Map result = instance.getDefaultNamesForPrincipalIds(principalIds);
129  1 assertEquals(2, result.size());
130   
131    }
132   
133    /**
134    * Test of getEmailType method, of class MockIdentityServiceImpl.
135    */
 
136  1 toggle @Test
137    public void testGetEmailType() {
138  1
139  1 String code = EmailTypeEnum.HOME.getCode();
140  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
141  1 EmailTypeInfo result = instance.getEmailType(code);
142  1 assertEquals(code, result.getCode());
143    }
144   
145    /**
146    * Test of getEmploymentStatus method, of class MockIdentityServiceImpl.
147    */
 
148  1 toggle @Test
149    public void testGetEmploymentStatus() {
150  1 System.out.println("getEmploymentStatus");
151  1 String code = EmployeeStatusEnum.ACTIVE.getCode();
152  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
153  1 EmploymentStatusInfo result = instance.getEmploymentStatus(code);
154  1 assertEquals(code, result.getCode());
155    }
156   
157    /**
158    * Test of getEmploymentType method, of class MockIdentityServiceImpl.
159    */
 
160  1 toggle @Test
161    public void testGetEmploymentType() {
162  1 System.out.println("getEmploymentType");
163  1 String code = EmployeeTypeEnum.PROFESSIONAL.getCode();
164  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
165  1 EmploymentTypeInfo result = instance.getEmploymentType(code);
166  1 assertEquals(code, result.getCode());
167    }
168   
169    /**
170    * Test of getEntityDefaultInfo method, of class MockIdentityServiceImpl.
171    */
 
172  1 toggle @Test
173    public void testGetEntityDefaultInfo() {
174  1 System.out.println("getEntityDefaultInfo");
175  1 String entityId = PersonEnum.STAFF1.getEntityId();
176  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
177  1 KimEntityDefaultInfo result = instance.getEntityDefaultInfo(entityId);
178  1 assertEquals(entityId, result.getEntityId());
179    }
180   
181    /**
182    * Test of getEntityDefaultInfoByPrincipalId method, of class MockIdentityServiceImpl.
183    */
 
184  1 toggle @Test
185    public void testGetEntityDefaultInfoByPrincipalId() {
186  1 System.out.println("getEntityDefaultInfoByPrincipalId");
187  1 String principalId = PersonEnum.STUDENT10.getPrincipalId();
188  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
189  1 KimEntityDefaultInfo result = instance.getEntityDefaultInfoByPrincipalId(principalId);
190  1 assertEquals(principalId, result.getPrincipals().get(0).getPrincipalId());
191    }
192   
193    /**
194    * Test of getEntityDefaultInfoByPrincipalName method, of class MockIdentityServiceImpl.
195    */
 
196  1 toggle @Test
197    public void testGetEntityDefaultInfoByPrincipalName() {
198  1 System.out.println("getEntityDefaultInfoByPrincipalName");
199  1 String principalName = PersonEnum.STUDENT10.getPrincipalName();
200  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
201  1 KimEntityDefaultInfo result = instance.getEntityDefaultInfoByPrincipalName(principalName);
202  1 assertEquals(principalName, result.getPrincipals().get(0).getPrincipalName());
203    }
204   
205    /**
206    * Test of getEntityInfo method, of class MockIdentityServiceImpl.
207    */
 
208  1 toggle @Test
209    public void testGetEntityInfo() {
210  1 System.out.println("getEntityInfo");
211  1 String entityId = PersonEnum.FACULTY12.getEntityId();
212  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
213  1 KimEntityInfo result = instance.getEntityInfo(entityId);
214  1 assertEquals(entityId, result.getEntityId());
215    }
216   
217    /**
218    * Test of getEntityInfoByPrincipalId method, of class MockIdentityServiceImpl.
219    */
 
220  1 toggle @Test
221    public void testGetEntityInfoByPrincipalId() {
222  1 System.out.println("getEntityInfoByPrincipalId");
223  1 String principalId = PersonEnum.FACULTY12.getPrincipalId();
224  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
225  1 KimEntityInfo result = instance.getEntityInfoByPrincipalId(principalId);
226  1 assertEquals(principalId, result.getPrincipals().get(0).getPrincipalId());
227    }
228   
229    /**
230    * Test of getEntityInfoByPrincipalName method, of class MockIdentityServiceImpl.
231    */
 
232  1 toggle @Test
233    public void testGetEntityInfoByPrincipalName() {
234  1 System.out.println("getEntityInfoByPrincipalName");
235  1 String principalName = PersonEnum.FACULTY12.getPrincipalName();
236  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
237  1 KimEntityInfo result = instance.getEntityInfoByPrincipalName(principalName);
238  1 assertEquals(principalName, result.getPrincipals().get(0).getPrincipalName());
239    }
240   
241    /**
242    * Test of getEntityNameType method, of class MockIdentityServiceImpl.
243    */
 
244  1 toggle @Test
245    public void testGetEntityNameType() {
246  1 System.out.println("getEntityNameType");
247  1 String code = EntityNameTypeEnum.PRIMARY.getCode();
248  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
249  1 EntityNameTypeInfo result = instance.getEntityNameType(code);
250  1 assertEquals(code, result.getCode());
251    }
252   
253    /**
254    * Test of getEntityPrivacyPreferences method, of class MockIdentityServiceImpl.
255    */
 
256  1 toggle @Test
257    public void testGetEntityPrivacyPreferences() {
258  1 System.out.println("getEntityPrivacyPreferences");
259  1 String entityId = PersonEnum.AFFILIATE4.getEntityId();
260  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
261  1 KimEntityPrivacyPreferencesInfo result = instance.getEntityPrivacyPreferences(entityId);
262  1 assertEquals(false, result.isSuppressAddress());
263    }
264   
265    /**
266    * Test of getEntityType method, of class MockIdentityServiceImpl.
267    */
 
268  1 toggle @Test
269    public void testGetEntityType() {
270  1 System.out.println("getEntityType");
271  1 String code = EntityTypeEnum.PERSON.getCode();
272  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
273  1 EntityTypeInfo result = instance.getEntityType(code);
274  1 assertEquals(code, result.getCode());
275    }
276   
277    /**
278    * Test of getExternalIdentifierType method, of class MockIdentityServiceImpl.
279    */
 
280  1 toggle @Test
281    public void testGetExternalIdentifierType() {
282  1 System.out.println("getExternalIdentifierType");
283  1 String code = ExternalIdentifierTypeEnum.TAX.getCode();
284  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
285  1 ExternalIdentifierTypeInfo result = instance.getExternalIdentifierType(code);
286  1 assertEquals(code, result.getCode());
287    }
288   
289    /**
290    * Test of getPhoneType method, of class MockIdentityServiceImpl.
291    */
 
292  1 toggle @Test
293    public void testGetPhoneType() {
294  1 System.out.println("getPhoneType");
295  1 String code = PhoneTypeEnum.MOBILE.getCode();
296  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
297  1 PhoneTypeInfo result = instance.getPhoneType(code);
298  1 assertEquals(code, result.getCode());
299    }
300   
301    /**
302    * Test of getPrincipal method, of class MockIdentityServiceImpl.
303    */
 
304  1 toggle @Test
305    public void testGetPrincipal() {
306  1 System.out.println("getPrincipal");
307  1 String principalId = PersonEnum.STAFF2.getPrincipalId();
308  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
309  1 KimPrincipalInfo result = instance.getPrincipal(principalId);
310  1 assertEquals(principalId, result.getPrincipalId());
311   
312    }
313   
314    /**
315    * Test of getPrincipalByPrincipalName method, of class MockIdentityServiceImpl.
316    */
 
317  1 toggle @Test
318    public void testGetPrincipalByPrincipalName() {
319  1 System.out.println("getPrincipalByPrincipalName");
320  1 String principalName = PersonEnum.FACULTY3.getPrincipalName();
321  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
322  1 KimPrincipalInfo result = instance.getPrincipalByPrincipalName(principalName);
323  1 assertEquals(principalName, result.getPrincipalName());
324    }
325   
326    /**
327    * Test of getPrincipalByPrincipalNameAndPassword method, of class MockIdentityServiceImpl.
328    */
 
329  1 toggle @Test
330    public void testGetPrincipalByPrincipalNameAndPassword() {
331  1 System.out.println("getPrincipalByPrincipalNameAndPassword");
332  1 String principalName = PersonEnum.FACULTY3.getPrincipalName();
333  1 String password = PersonEnum.FACULTY3.getPassword();
334  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
335  1 KimPrincipalInfo result = instance.getPrincipalByPrincipalNameAndPassword(principalName, password);
336  1 assertEquals(principalName, result.getPrincipalName());
337  1 assertEquals(password, result.getPassword());
338  1 assertNull(instance.getPrincipalByPrincipalNameAndPassword(principalName, password + "XXXXX"));
339    }
340   
341    /**
342    * Test of lookupEntityDefaultInfo method, of class MockIdentityServiceImpl.
343    */
 
344  1 toggle @Test
345    public void testLookupEntityDefaultInfo() {
346  1 System.out.println("lookupEntityDefaultInfo");
347  1 Map<String, String> searchCriteria = null;
348  1 boolean unbounded = true;
349  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
350   
351    // all
352  1 searchCriteria = new HashMap<String, String>();
353  1 unbounded = true;
354  1 List<KimEntityDefaultInfo> results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
355  1 assertEquals(212, results.size());
356   
357    // bounded
358  1 searchCriteria = new HashMap<String, String>();
359  1 unbounded = false;
360  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
361  1 assertEquals(100, results.size());
362   
363    // just students
364  1 searchCriteria = new HashMap<String, String>();
365  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.STUDENT.getCode());
366  1 unbounded = true;
367  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
368  1 assertEquals(80, results.size());
369   
370    // just faculty
371  1 searchCriteria = new HashMap<String, String>();
372  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.FACULTY.getCode());
373  1 unbounded = true;
374  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
375  1 assertEquals(60, results.size());
376   
377    // just staff
378  1 searchCriteria = new HashMap<String, String>();
379  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.STAFF.getCode());
380  1 unbounded = true;
381  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
382  1 assertEquals(62, results.size());
383   
384    // just affiliates
385  1 searchCriteria = new HashMap<String, String>();
386  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.AFFILIATE.getCode());
387  1 unbounded = true;
388  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
389  1 assertEquals(10, results.size());
390   
391    // just students with name = "Manning"
392  1 searchCriteria = new HashMap<String, String>();
393  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.STUDENT.getCode());
394  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_LAST_NAME, "Manning");
395  1 unbounded = true;
396  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
397  1 assertEquals(1, results.size());
398   
399    // just students with name like "Ma*"
400  1 searchCriteria = new HashMap<String, String>();
401  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_AFFILIATION_TYPE_CODE, AffiliationTypeEnum.STUDENT.getCode());
402  1 searchCriteria.put(IdentityServiceConstants.KIM_PERSON_LAST_NAME, "Ma*");
403  1 unbounded = true;
404  1 results = instance.lookupEntityDefaultInfo(searchCriteria, unbounded);
405  1 for (KimEntityDefaultInfo info : results) {
406  3 assertEquals(AffiliationTypeEnum.STUDENT.getCode(), info.getDefaultAffiliation().getAffiliationTypeCode());
407  3 assertEquals("Ma", info.getDefaultName().getLastName().substring(0, 2));
408    }
409  1 assertEquals(3, results.size());
410    }
411   
412    /**
413    * Test of lookupEntityInfo method, of class MockIdentityServiceImpl.
414    */
 
415  1 toggle @Test
416    public void testLookupEntityInfo() {
417  1 System.out.println("lookupEntityInfo");
418  1 Map<String, String> searchCriteria = null;
419  1 boolean unbounded = true;
420  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
421   
422    // all
423  1 searchCriteria = new HashMap<String, String>();
424  1 unbounded = true;
425  1 List<KimEntityInfo> results = instance.lookupEntityInfo(searchCriteria, unbounded);
426  1 assertEquals(212, results.size());
427    }
428   
429    /**
430    * Test of getMatchingEntityCount method, of class MockIdentityServiceImpl.
431    */
 
432  1 toggle @Test
433    public void testGetMatchingEntityCount() {
434  1 System.out.println("getMatchingEntityCount");
435  1 Map<String, String> searchCriteria = null;
436  1 IdentityServiceMockImpl instance = new IdentityServiceMockImpl();
437   
438    // all
439  1 searchCriteria = new HashMap<String, String>();
440  1 int results = instance.getMatchingEntityCount(searchCriteria);
441  1 assertEquals(212, results);
442    }
443    }