Clover Coverage Report - KS LUM 1.2-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Mar 3 2011 05:26:43 EST
126   511   51   2.47
0   407   0.4   25.5
51     1  
2    
 
  LrcContextImplTest       Line # 41 69 0% 12 0 100% 1.0
  LrcContextImplTest.LrcServiceMock       Line # 170 57 0% 39 70 27.1% 0.27083334
 
  (7)
 
1    package org.kuali.student.lum.statement.config.context;
2   
3    import java.util.ArrayList;
4    import java.util.Arrays;
5    import java.util.HashMap;
6    import java.util.List;
7    import java.util.Map;
8   
9    import org.junit.Assert;
10    import org.junit.Before;
11    import org.junit.Test;
12    import org.kuali.student.common.dictionary.dto.ObjectStructureDefinition;
13    import org.kuali.student.common.dto.StatusInfo;
14    import org.kuali.student.common.exceptions.AlreadyExistsException;
15    import org.kuali.student.common.exceptions.DataValidationErrorException;
16    import org.kuali.student.common.exceptions.DoesNotExistException;
17    import org.kuali.student.common.exceptions.InvalidParameterException;
18    import org.kuali.student.common.exceptions.MissingParameterException;
19    import org.kuali.student.common.exceptions.OperationFailedException;
20    import org.kuali.student.common.exceptions.PermissionDeniedException;
21    import org.kuali.student.common.exceptions.VersionMismatchException;
22    import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo;
23    import org.kuali.student.common.search.dto.SearchRequest;
24    import org.kuali.student.common.search.dto.SearchResult;
25    import org.kuali.student.common.search.dto.SearchResultTypeInfo;
26    import org.kuali.student.common.search.dto.SearchTypeInfo;
27    import org.kuali.student.core.statement.dto.ReqCompFieldInfo;
28    import org.kuali.student.core.statement.dto.ReqComponentInfo;
29    import org.kuali.student.lum.lrc.dto.CredentialInfo;
30    import org.kuali.student.lum.lrc.dto.CredentialTypeInfo;
31    import org.kuali.student.lum.lrc.dto.CreditInfo;
32    import org.kuali.student.lum.lrc.dto.CreditTypeInfo;
33    import org.kuali.student.lum.lrc.dto.GradeInfo;
34    import org.kuali.student.lum.lrc.dto.GradeTypeInfo;
35    import org.kuali.student.lum.lrc.dto.ResultComponentInfo;
36    import org.kuali.student.lum.lrc.dto.ResultComponentTypeInfo;
37    import org.kuali.student.lum.lrc.dto.ScaleInfo;
38    import org.kuali.student.lum.lrc.service.LrcService;
39    import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes;
40   
 
41    public class LrcContextImplTest {
42    private LrcService lrcService = new LrcServiceMock();
43    private LrcContextImpl lrcContext = new LrcContextImpl();
44    private ReqComponentInfo reqComponent1;
45    private ReqComponentInfo reqComponent2;
46    private ReqComponentInfo reqComponent3;
47    private ReqComponentInfo reqComponent4;
48   
 
49  7 toggle private void setupReqComponent1() {
50  7 reqComponent1 = new ReqComponentInfo();
51  7 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
52  7 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
53  7 reqCompField1.setType(ReqComponentFieldTypes.GRADE_KEY.getId());
54  7 reqCompField1.setValue("A");
55  7 reqCompFieldList.add(reqCompField1);
56  7 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
57  7 reqCompField2.setType(ReqComponentFieldTypes.GRADE_TYPE_KEY.getId());
58  7 reqCompField2.setValue("kuali.resultComponent.grade.letter");
59  7 reqCompFieldList.add(reqCompField2);
60   
61  7 reqComponent1.setReqCompFields(reqCompFieldList);
62    }
63   
 
64  7 toggle private void setupReqComponent2() {
65  7 reqComponent2 = new ReqComponentInfo();
66  7 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
67  7 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
68  7 reqCompField1.setType(ReqComponentFieldTypes.GRADE_KEY.getId());
69  7 reqCompField1.setValue(null);
70  7 reqCompFieldList.add(reqCompField1);
71  7 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
72  7 reqCompField2.setType(ReqComponentFieldTypes.GRADE_TYPE_KEY.getId());
73  7 reqCompField2.setValue(null);
74  7 reqCompFieldList.add(reqCompField2);
75   
76  7 reqComponent2.setReqCompFields(reqCompFieldList);
77    }
78   
 
79  7 toggle private void setupReqComponent3() {
80  7 reqComponent3 = new ReqComponentInfo();
81  7 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
82  7 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
83  7 reqCompField1.setType(ReqComponentFieldTypes.GRADE_TYPE_KEY.getId());
84  7 reqCompField1.setValue("kuali.resultComponent.grade.letter");
85  7 reqCompFieldList.add(reqCompField1);
86   
87  7 reqComponent3.setReqCompFields(reqCompFieldList);
88    }
89   
 
90  7 toggle private void setupReqComponent4() {
91  7 reqComponent4 = new ReqComponentInfo();
92  7 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
93  7 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
94  7 reqCompField1.setType(ReqComponentFieldTypes.GRADE_KEY.getId());
95  7 reqCompField1.setValue("A");
96  7 reqCompFieldList.add(reqCompField1);
97   
98  7 reqComponent4.setReqCompFields(reqCompFieldList);
99    }
100   
 
101  7 toggle @Before
102    public void beforeMethod() {
103  7 lrcContext.setLrcService(lrcService);
104  7 setupReqComponent1();
105  7 setupReqComponent2();
106  7 setupReqComponent3();
107  7 setupReqComponent4();
108    }
109   
 
110  1 toggle @Test
111    public void testCreateContextMap() throws OperationFailedException {
112  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent1);
113  1 Assert.assertNotNull(contextMap);
114  1 Assert.assertTrue(contextMap.containsKey(LrcContextImpl.GRADE_TOKEN));
115  1 Assert.assertTrue(contextMap.containsKey(LrcContextImpl.GRADE_TYPE_TOKEN));
116    }
117   
 
118  1 toggle @Test
119    public void testCreateContextMap_GradeTypeToken() throws OperationFailedException {
120  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent3);
121  1 Assert.assertNotNull(contextMap);
122  1 Assert.assertTrue(contextMap.containsKey(LrcContextImpl.GRADE_TYPE_TOKEN));
123    }
124   
 
125  1 toggle @Test
126    public void testCreateContextMap_GradeToken() throws OperationFailedException {
127  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent4);
128  1 Assert.assertNotNull(contextMap);
129  1 Assert.assertTrue(contextMap.containsKey(LrcContextImpl.GRADE_TOKEN));
130    }
131   
 
132  1 toggle @Test
133    public void testCreateContextMap_GradeTypeTokenValues() throws OperationFailedException {
134  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent3);
135  1 ResultComponentInfo gradeTypeId = (ResultComponentInfo) contextMap.get(LrcContextImpl.GRADE_TYPE_TOKEN);
136   
137  1 Assert.assertEquals("kuali.resultComponent.grade.letter", gradeTypeId.getId());
138    }
139   
 
140  1 toggle @Test
141    public void testCreateContextMap_GradeTokenValues() throws OperationFailedException {
142  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent4);
143  1 ResultComponentInfo gradeTypeId = (ResultComponentInfo) contextMap.get(LrcContextImpl.GRADE_TYPE_TOKEN);
144  1 String gradeId = (String) contextMap.get(LrcContextImpl.GRADE_TOKEN);
145   
146  1 Assert.assertEquals("kuali.resultComponent.grade.letter", gradeTypeId.getId());
147  1 Assert.assertEquals("A", gradeId);
148    }
149   
 
150  1 toggle @Test
151    public void testCreateContextMap_TokenValues() throws OperationFailedException {
152  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent1);
153  1 ResultComponentInfo gradeTypeId = (ResultComponentInfo) contextMap.get(LrcContextImpl.GRADE_TYPE_TOKEN);
154  1 String gradeId = (String) contextMap.get(LrcContextImpl.GRADE_TOKEN);
155   
156  1 Assert.assertEquals("kuali.resultComponent.grade.letter", gradeTypeId.getId());
157  1 Assert.assertEquals("A", gradeId);
158    }
159   
 
160  1 toggle @Test
161    public void testCreateContextMap_NullTokenValues() throws OperationFailedException {
162  1 Map<String, Object> contextMap = lrcContext.createContextMap(reqComponent2);
163  1 ResultComponentInfo gradeTypeId = (ResultComponentInfo) contextMap.get(LrcContextImpl.GRADE_TYPE_TOKEN);
164  1 String gradeId = (String) contextMap.get(LrcContextImpl.GRADE_TOKEN);
165   
166  1 Assert.assertEquals(null, gradeTypeId);
167  1 Assert.assertEquals(null, gradeId);
168    }
169   
 
170    private static class LrcServiceMock implements LrcService {
171   
172    private Map<String, ResultComponentInfo> resultComponentMap = new HashMap<String, ResultComponentInfo>();
173    private List<ResultComponentTypeInfo> resultComponentTypeList = new ArrayList<ResultComponentTypeInfo>();
174    private Map<String, List<String>> typeIdMap = new HashMap<String, List<String>>();
175   
 
176  7 toggle public LrcServiceMock() {
177  7 ResultComponentInfo rc1 = new ResultComponentInfo();
178  7 rc1.setId("kuali.resultComponent.grade.letter");
179  7 rc1.setName("Letter");
180  7 rc1.setResultValues(Arrays.asList(new String[] {"A", "B", "C", "D", "F"}));
181  7 resultComponentMap.put("kuali.resultComponent.grade.letter", rc1);
182   
183  7 ResultComponentInfo rc2 = new ResultComponentInfo();
184  7 rc2.setId("kuali.resultComponent.grade.passFail");
185  7 rc2.setName("Pass-Fail");
186  7 rc2.setResultValues(Arrays.asList(new String[] {"Pass", "Fail"}));
187  7 resultComponentMap.put("kuali.resultComponent.grade.passFail", rc2);
188   
189  7 ResultComponentTypeInfo type1 = new ResultComponentTypeInfo();
190  7 type1.setId("kuali.resultComponentType.grade.finalGrade");
191  7 type1.setName("Final Grade");
192  7 resultComponentTypeList.add(type1);
193   
194  7 ResultComponentTypeInfo type2 = new ResultComponentTypeInfo();
195  7 type2.setId("kuali.resultComponentType.credit.degree.fixed");
196  7 type2.setName("Fixed Number");
197  7 resultComponentTypeList.add(type2);
198   
199  7 typeIdMap.put("kuali.resultComponentType.grade.finalGrade", Arrays.asList(new String[] {"kuali.resultComponent.grade.letter", "kuali.resultComponent.grade.passFail"}));
200    }
201   
 
202  0 toggle @Override
203    public String compareGrades(String gradeKey, String scaleKey,
204    String compareGradeKey, String compareScaleKey)
205    throws InvalidParameterException, MissingParameterException,
206    OperationFailedException {
207    // TODO Auto-generated method stub
208  0 return null;
209    }
210   
 
211  0 toggle @Override
212    public ResultComponentInfo createResultComponent(
213    String resultComponentTypeKey,
214    ResultComponentInfo resultComponentInfo)
215    throws AlreadyExistsException, DataValidationErrorException,
216    DoesNotExistException, InvalidParameterException,
217    MissingParameterException, OperationFailedException,
218    PermissionDeniedException {
219    // TODO Auto-generated method stub
220  0 return null;
221    }
222   
 
223  0 toggle @Override
224    public StatusInfo deleteResultComponent(String resultComponentId)
225    throws DoesNotExistException, InvalidParameterException,
226    MissingParameterException, OperationFailedException,
227    PermissionDeniedException {
228    // TODO Auto-generated method stub
229  0 return null;
230    }
231   
 
232  0 toggle @Override
233    public CredentialInfo getCredential(String credentialKey)
234    throws DoesNotExistException, InvalidParameterException,
235    MissingParameterException, OperationFailedException {
236    // TODO Auto-generated method stub
237  0 return null;
238    }
239   
 
240  0 toggle @Override
241    public List<String> getCredentialKeysByCredentialType(
242    String credentialTypeKey) throws DoesNotExistException,
243    InvalidParameterException, MissingParameterException,
244    OperationFailedException {
245    // TODO Auto-generated method stub
246  0 return null;
247    }
248   
 
249  0 toggle @Override
250    public CredentialTypeInfo getCredentialType(String credentialTypeKey)
251    throws DoesNotExistException, InvalidParameterException,
252    MissingParameterException, OperationFailedException {
253    // TODO Auto-generated method stub
254  0 return null;
255    }
256   
 
257  0 toggle @Override
258    public List<CredentialTypeInfo> getCredentialTypes()
259    throws OperationFailedException {
260    // TODO Auto-generated method stub
261  0 return null;
262    }
263   
 
264  0 toggle @Override
265    public List<CredentialInfo> getCredentialsByKeyList(
266    List<String> credentialKeyList) throws DoesNotExistException,
267    InvalidParameterException, MissingParameterException,
268    OperationFailedException {
269    // TODO Auto-generated method stub
270  0 return null;
271    }
272   
 
273  0 toggle @Override
274    public CreditInfo getCredit(String creditKey)
275    throws DoesNotExistException, InvalidParameterException,
276    MissingParameterException, OperationFailedException {
277    // TODO Auto-generated method stub
278  0 return null;
279    }
280   
 
281  0 toggle @Override
282    public List<String> getCreditKeysByCreditType(String creditTypeKey)
283    throws DoesNotExistException, InvalidParameterException,
284    MissingParameterException, OperationFailedException {
285    // TODO Auto-generated method stub
286  0 return null;
287    }
288   
 
289  0 toggle @Override
290    public CreditTypeInfo getCreditType(String creditTypeKey)
291    throws DoesNotExistException, InvalidParameterException,
292    MissingParameterException, OperationFailedException {
293    // TODO Auto-generated method stub
294  0 return null;
295    }
296   
 
297  0 toggle @Override
298    public List<CreditTypeInfo> getCreditTypes()
299    throws OperationFailedException {
300    // TODO Auto-generated method stub
301  0 return null;
302    }
303   
 
304  0 toggle @Override
305    public List<CreditInfo> getCreditsByKeyList(List<String> creditKeyList)
306    throws DoesNotExistException, InvalidParameterException,
307    MissingParameterException, OperationFailedException {
308    // TODO Auto-generated method stub
309  0 return null;
310    }
311   
 
312  0 toggle @Override
313    public GradeInfo getGrade(String gradeKey)
314    throws DoesNotExistException, InvalidParameterException,
315    MissingParameterException, OperationFailedException {
316    // TODO Auto-generated method stub
317  0 return null;
318    }
319   
 
320  0 toggle @Override
321    public List<String> getGradeKeysByGradeType(String gradeTypeKey)
322    throws DoesNotExistException, InvalidParameterException,
323    MissingParameterException, OperationFailedException {
324    // TODO Auto-generated method stub
325  0 return null;
326    }
327   
 
328  0 toggle @Override
329    public GradeTypeInfo getGradeType(String gradeTypeKey)
330    throws DoesNotExistException, InvalidParameterException,
331    MissingParameterException, OperationFailedException {
332    // TODO Auto-generated method stub
333  0 return null;
334    }
335   
 
336  0 toggle @Override
337    public List<GradeTypeInfo> getGradeTypes()
338    throws OperationFailedException {
339    // TODO Auto-generated method stub
340  0 return null;
341    }
342   
 
343  0 toggle @Override
344    public List<GradeInfo> getGradesByKeyList(List<String> gradeKeyList)
345    throws DoesNotExistException, InvalidParameterException,
346    MissingParameterException, OperationFailedException {
347    // TODO Auto-generated method stub
348  0 return null;
349    }
350   
 
351  0 toggle @Override
352    public List<GradeInfo> getGradesByScale(String scale)
353    throws DoesNotExistException, InvalidParameterException,
354    MissingParameterException, OperationFailedException {
355    // TODO Auto-generated method stub
356  0 return null;
357    }
358   
 
359  6 toggle @Override
360    public ResultComponentInfo getResultComponent(String resultComponentId)
361    throws DoesNotExistException, InvalidParameterException,
362    MissingParameterException, OperationFailedException {
363  6 return resultComponentMap.get(resultComponentId);
364    }
365   
 
366  0 toggle @Override
367    public List<String> getResultComponentIdsByResult(String resultValueId,
368    String resultComponentTypeKey) throws DoesNotExistException,
369    InvalidParameterException, MissingParameterException,
370    OperationFailedException {
371    // TODO Auto-generated method stub
372  0 return null;
373    }
374   
 
375  4 toggle @Override
376    public List<String> getResultComponentIdsByResultComponentType(
377    String resultComponentTypeKey) throws DoesNotExistException,
378    InvalidParameterException, MissingParameterException,
379    OperationFailedException {
380  4 return typeIdMap.get(resultComponentTypeKey);
381    }
382   
 
383  0 toggle @Override
384    public ResultComponentTypeInfo getResultComponentType(
385    String resultComponentTypeKey) throws DoesNotExistException,
386    InvalidParameterException, MissingParameterException,
387    OperationFailedException {
388    // TODO Auto-generated method stub
389  0 return null;
390    }
391   
 
392  4 toggle @Override
393    public List<ResultComponentTypeInfo> getResultComponentTypes()
394    throws OperationFailedException {
395  4 return this.resultComponentTypeList;
396    }
397   
 
398  0 toggle @Override
399    public ScaleInfo getScale(String scaleKey)
400    throws DoesNotExistException, InvalidParameterException,
401    MissingParameterException, OperationFailedException {
402    // TODO Auto-generated method stub
403  0 return null;
404    }
405   
 
406  0 toggle @Override
407    public List<GradeInfo> translateGrade(String gradeKey, String scaleKey,
408    String translateScaleKey) throws InvalidParameterException,
409    MissingParameterException, OperationFailedException {
410    // TODO Auto-generated method stub
411  0 return null;
412    }
413   
 
414  0 toggle @Override
415    public ResultComponentInfo updateResultComponent(
416    String resultComponentId,
417    ResultComponentInfo resultComponentInfo)
418    throws DataValidationErrorException, DoesNotExistException,
419    InvalidParameterException, MissingParameterException,
420    OperationFailedException, PermissionDeniedException,
421    VersionMismatchException {
422    // TODO Auto-generated method stub
423  0 return null;
424    }
425   
 
426  0 toggle @Override
427    public SearchCriteriaTypeInfo getSearchCriteriaType(
428    String searchCriteriaTypeKey) throws DoesNotExistException,
429    InvalidParameterException, MissingParameterException,
430    OperationFailedException {
431    // TODO Auto-generated method stub
432  0 return null;
433    }
434   
 
435  0 toggle @Override
436    public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes()
437    throws OperationFailedException {
438    // TODO Auto-generated method stub
439  0 return null;
440    }
441   
 
442  0 toggle @Override
443    public SearchResultTypeInfo getSearchResultType(
444    String searchResultTypeKey) throws DoesNotExistException,
445    InvalidParameterException, MissingParameterException,
446    OperationFailedException {
447    // TODO Auto-generated method stub
448  0 return null;
449    }
450   
 
451  0 toggle @Override
452    public List<SearchResultTypeInfo> getSearchResultTypes()
453    throws OperationFailedException {
454    // TODO Auto-generated method stub
455  0 return null;
456    }
457   
 
458  0 toggle @Override
459    public SearchTypeInfo getSearchType(String searchTypeKey)
460    throws DoesNotExistException, InvalidParameterException,
461    MissingParameterException, OperationFailedException {
462    // TODO Auto-generated method stub
463  0 return null;
464    }
465   
 
466  0 toggle @Override
467    public List<SearchTypeInfo> getSearchTypes()
468    throws OperationFailedException {
469    // TODO Auto-generated method stub
470  0 return null;
471    }
472   
 
473  0 toggle @Override
474    public List<SearchTypeInfo> getSearchTypesByCriteria(
475    String searchCriteriaTypeKey) throws DoesNotExistException,
476    InvalidParameterException, MissingParameterException,
477    OperationFailedException {
478    // TODO Auto-generated method stub
479  0 return null;
480    }
481   
 
482  0 toggle @Override
483    public List<SearchTypeInfo> getSearchTypesByResult(
484    String searchResultTypeKey) throws DoesNotExistException,
485    InvalidParameterException, MissingParameterException,
486    OperationFailedException {
487    // TODO Auto-generated method stub
488  0 return null;
489    }
490   
 
491  0 toggle @Override
492    public SearchResult search(SearchRequest searchRequest)
493    throws MissingParameterException {
494    // TODO Auto-generated method stub
495  0 return null;
496    }
497   
 
498  0 toggle @Override
499    public ObjectStructureDefinition getObjectStructure(String objectTypeKey) {
500    // TODO Kamal - THIS METHOD NEEDS JAVADOCS
501  0 return null;
502    }
503   
 
504  0 toggle @Override
505    public List<String> getObjectTypes() {
506    // TODO Kamal - THIS METHOD NEEDS JAVADOCS
507  0 return null;
508    }
509   
510    }
511    }