Clover Coverage Report - KS LUM Impl 1.1.0-SNAPSHOT
Coverage timestamp: Mon Feb 14 2011 05:53:28 EST
91   495   51   1.78
0   390   0.56   25.5
51     1  
2    
 
  AtpContextImplTest       Line # 39 39 0% 6 0 100% 1.0
  AtpContextImplTest.AtpServiceMock       Line # 110 52 0% 45 86 11.3% 0.11340206
 
  (3)
 
1    package org.kuali.student.lum.statement.config.context;
2   
3    import java.util.ArrayList;
4    import java.util.Date;
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.core.atp.dto.AtpDurationTypeInfo;
13    import org.kuali.student.core.atp.dto.AtpInfo;
14    import org.kuali.student.core.atp.dto.AtpSeasonalTypeInfo;
15    import org.kuali.student.core.atp.dto.AtpTypeInfo;
16    import org.kuali.student.core.atp.dto.DateRangeInfo;
17    import org.kuali.student.core.atp.dto.DateRangeTypeInfo;
18    import org.kuali.student.core.atp.dto.MilestoneInfo;
19    import org.kuali.student.core.atp.dto.MilestoneTypeInfo;
20    import org.kuali.student.core.atp.service.AtpService;
21    import org.kuali.student.core.dto.StatusInfo;
22    import org.kuali.student.core.exceptions.AlreadyExistsException;
23    import org.kuali.student.core.exceptions.DataValidationErrorException;
24    import org.kuali.student.core.exceptions.DoesNotExistException;
25    import org.kuali.student.core.exceptions.InvalidParameterException;
26    import org.kuali.student.core.exceptions.MissingParameterException;
27    import org.kuali.student.core.exceptions.OperationFailedException;
28    import org.kuali.student.core.exceptions.PermissionDeniedException;
29    import org.kuali.student.core.exceptions.VersionMismatchException;
30    import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo;
31    import org.kuali.student.core.search.dto.SearchRequest;
32    import org.kuali.student.core.search.dto.SearchResult;
33    import org.kuali.student.core.search.dto.SearchResultTypeInfo;
34    import org.kuali.student.core.search.dto.SearchTypeInfo;
35    import org.kuali.student.core.statement.dto.ReqCompFieldInfo;
36    import org.kuali.student.core.statement.dto.ReqComponentInfo;
37    import org.kuali.student.core.validation.dto.ValidationResultInfo;
38   
 
39    public class AtpContextImplTest {
40    private AtpService atpService = new AtpServiceMock();
41    private AtpContextImpl atpContext = new AtpContextImpl();
42    private ReqComponentInfo reqComponent1;
43    private ReqComponentInfo reqComponent2;
44   
 
45  3 toggle private void setupReqComponent1() {
46  3 reqComponent1 = new ReqComponentInfo();
47  3 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
48  3 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
49  3 reqCompField1.setType("kuali.reqComponent.field.type.duration");
50  3 reqCompField1.setValue("2");
51  3 reqCompFieldList.add(reqCompField1);
52  3 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
53  3 reqCompField2.setType("kuali.reqComponent.field.type.durationType.id");
54  3 reqCompField2.setValue("kuali.atp.duration.Year");
55  3 reqCompFieldList.add(reqCompField2);
56   
57  3 reqComponent1.setReqCompFields(reqCompFieldList);
58    }
59   
 
60  3 toggle private void setupReqComponent2() {
61  3 reqComponent2 = new ReqComponentInfo();
62  3 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
63  3 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
64  3 reqCompField1.setType("kuali.reqComponent.field.type.duration");
65  3 reqCompField1.setValue(null);
66  3 reqCompFieldList.add(reqCompField1);
67  3 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
68  3 reqCompField2.setType("kuali.reqComponent.field.type.durationType.id");
69  3 reqCompField2.setValue(null);
70  3 reqCompFieldList.add(reqCompField2);
71   
72  3 reqComponent2.setReqCompFields(reqCompFieldList);
73    }
74   
 
75  3 toggle @Before
76    public void beforeMethod() {
77  3 atpContext.setAtpService(atpService);
78  3 setupReqComponent1();
79  3 setupReqComponent2();
80    }
81   
 
82  1 toggle @Test
83    public void testCreateContextMap_ContainsTokens() throws OperationFailedException {
84  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent1);
85  1 Assert.assertNotNull(contextMap);
86  1 Assert.assertTrue(contextMap.containsKey(AtpContextImpl.DURATION_TOKEN));
87  1 Assert.assertTrue(contextMap.containsKey(AtpContextImpl.DURATION_TYPE_TOKEN));
88    }
89   
 
90  1 toggle @Test
91    public void testCreateContextMap_TokenValues() throws OperationFailedException {
92  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent1);
93  1 String duration = (String) contextMap.get(AtpContextImpl.DURATION_TOKEN);
94  1 AtpDurationTypeInfo type = (AtpDurationTypeInfo) contextMap.get(AtpContextImpl.DURATION_TYPE_TOKEN);
95   
96  1 Assert.assertEquals("2", duration);
97  1 Assert.assertEquals("kuali.atp.duration.Year", type.getId());
98    }
99   
 
100  1 toggle @Test
101    public void testCreateContextMap_NullTokenValues() throws OperationFailedException {
102  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent2);
103  1 String duration = (String) contextMap.get(AtpContextImpl.DURATION_TOKEN);
104  1 AtpDurationTypeInfo type = (AtpDurationTypeInfo) contextMap.get(AtpContextImpl.DURATION_TYPE_TOKEN);
105   
106  1 Assert.assertEquals(null, duration);
107  1 Assert.assertEquals(null, type);
108    }
109   
 
110    private static class AtpServiceMock implements AtpService {
111   
112    private Map<String, AtpDurationTypeInfo> durationTypeMap = new HashMap<String, AtpDurationTypeInfo>();
113   
 
114  3 toggle public AtpServiceMock() {
115  3 AtpDurationTypeInfo type1 = new AtpDurationTypeInfo();
116  3 type1.setId("kuali.atp.duration.Year");
117  3 type1.setName("Year");
118  3 durationTypeMap.put("kuali.atp.duration.Year", type1);
119   
120  3 AtpDurationTypeInfo type2 = new AtpDurationTypeInfo();
121  3 type2.setId("kuali.atp.duration.Term");
122  3 type2.setName("Term");
123  3 durationTypeMap.put("kuali.atp.duration.Term", type2);
124    }
125   
 
126  0 toggle @Override
127    public DateRangeInfo addDateRange(String atpKey, String dateRangeKey,
128    DateRangeInfo dateRangeInfo) throws AlreadyExistsException,
129    DataValidationErrorException, InvalidParameterException,
130    MissingParameterException, OperationFailedException,
131    PermissionDeniedException {
132    // TODO Auto-generated method stub
133  0 return null;
134    }
135   
 
136  0 toggle @Override
137    public MilestoneInfo addMilestone(String atpKey, String milestoneKey,
138    MilestoneInfo milestoneInfo) throws AlreadyExistsException,
139    DataValidationErrorException, InvalidParameterException,
140    MissingParameterException, OperationFailedException,
141    PermissionDeniedException {
142    // TODO Auto-generated method stub
143  0 return null;
144    }
145   
 
146  0 toggle @Override
147    public AtpInfo createAtp(String atpTypeKey, String atpKey,
148    AtpInfo atpInfo) throws AlreadyExistsException,
149    DataValidationErrorException, InvalidParameterException,
150    MissingParameterException, OperationFailedException,
151    PermissionDeniedException {
152    // TODO Auto-generated method stub
153  0 return null;
154    }
155   
 
156  0 toggle @Override
157    public StatusInfo deleteAtp(String atpKey)
158    throws DoesNotExistException, InvalidParameterException,
159    MissingParameterException, OperationFailedException,
160    PermissionDeniedException {
161    // TODO Auto-generated method stub
162  0 return null;
163    }
164   
 
165  0 toggle @Override
166    public AtpInfo getAtp(String atpKey) throws DoesNotExistException,
167    InvalidParameterException, MissingParameterException,
168    OperationFailedException {
169    // TODO Auto-generated method stub
170  0 return null;
171    }
172   
 
173  2 toggle @Override
174    public AtpDurationTypeInfo getAtpDurationType(String atpDurationTypeKey)
175    throws DoesNotExistException, InvalidParameterException,
176    MissingParameterException, OperationFailedException {
177  2 return durationTypeMap.get(atpDurationTypeKey);
178    }
179   
 
180  0 toggle @Override
181    public List<AtpDurationTypeInfo> getAtpDurationTypes()
182    throws OperationFailedException {
183    // TODO Auto-generated method stub
184  0 return null;
185    }
186   
 
187  0 toggle @Override
188    public AtpSeasonalTypeInfo getAtpSeasonalType(String atpSeasonalTypeKey)
189    throws DoesNotExistException, InvalidParameterException,
190    MissingParameterException, OperationFailedException {
191    // TODO Auto-generated method stub
192  0 return null;
193    }
194   
 
195  0 toggle @Override
196    public List<AtpSeasonalTypeInfo> getAtpSeasonalTypes()
197    throws OperationFailedException {
198    // TODO Auto-generated method stub
199  0 return null;
200    }
201   
 
202  0 toggle @Override
203    public AtpTypeInfo getAtpType(String atpTypeKey)
204    throws DoesNotExistException, InvalidParameterException,
205    MissingParameterException, OperationFailedException {
206    // TODO Auto-generated method stub
207  0 return null;
208    }
209   
 
210  0 toggle @Override
211    public List<AtpTypeInfo> getAtpTypes() throws OperationFailedException {
212    // TODO Auto-generated method stub
213  0 return null;
214    }
215   
 
216  0 toggle @Override
217    public List<AtpInfo> getAtpsByAtpType(String atpTypeKey)
218    throws InvalidParameterException, MissingParameterException,
219    OperationFailedException {
220    // TODO Auto-generated method stub
221  0 return null;
222    }
223   
 
224  0 toggle @Override
225    public List<AtpInfo> getAtpsByDate(Date searchDate)
226    throws InvalidParameterException, MissingParameterException,
227    OperationFailedException {
228    // TODO Auto-generated method stub
229  0 return null;
230    }
231   
 
232  0 toggle @Override
233    public List<AtpInfo> getAtpsByDates(Date startDate, Date endDate)
234    throws InvalidParameterException, MissingParameterException,
235    OperationFailedException {
236    // TODO Auto-generated method stub
237  0 return null;
238    }
239   
 
240  0 toggle @Override
241    public DateRangeInfo getDateRange(String dateRangeKey)
242    throws DoesNotExistException, InvalidParameterException,
243    MissingParameterException, OperationFailedException {
244    // TODO Auto-generated method stub
245  0 return null;
246    }
247   
 
248  0 toggle @Override
249    public DateRangeTypeInfo getDateRangeType(String dateRangeTypeKey)
250    throws DoesNotExistException, InvalidParameterException,
251    MissingParameterException, OperationFailedException {
252    // TODO Auto-generated method stub
253  0 return null;
254    }
255   
 
256  0 toggle @Override
257    public List<DateRangeTypeInfo> getDateRangeTypes()
258    throws OperationFailedException {
259    // TODO Auto-generated method stub
260  0 return null;
261    }
262   
 
263  0 toggle @Override
264    public List<DateRangeTypeInfo> getDateRangeTypesForAtpType(
265    String atpTypeKey) throws DoesNotExistException,
266    InvalidParameterException, MissingParameterException,
267    OperationFailedException {
268    // TODO Auto-generated method stub
269  0 return null;
270    }
271   
 
272  0 toggle @Override
273    public List<DateRangeInfo> getDateRangesByAtp(String atpKey)
274    throws InvalidParameterException, MissingParameterException,
275    OperationFailedException {
276    // TODO Auto-generated method stub
277  0 return null;
278    }
279   
 
280  0 toggle @Override
281    public List<DateRangeInfo> getDateRangesByDate(Date searchDate)
282    throws InvalidParameterException, MissingParameterException,
283    OperationFailedException {
284    // TODO Auto-generated method stub
285  0 return null;
286    }
287   
 
288  0 toggle @Override
289    public MilestoneInfo getMilestone(String milestoneKey)
290    throws DoesNotExistException, InvalidParameterException,
291    MissingParameterException, OperationFailedException {
292    // TODO Auto-generated method stub
293  0 return null;
294    }
295   
 
296  0 toggle @Override
297    public MilestoneTypeInfo getMilestoneType(String milestoneTypeKey)
298    throws DoesNotExistException, InvalidParameterException,
299    MissingParameterException, OperationFailedException {
300    // TODO Auto-generated method stub
301  0 return null;
302    }
303   
 
304  0 toggle @Override
305    public List<MilestoneTypeInfo> getMilestoneTypes()
306    throws OperationFailedException {
307    // TODO Auto-generated method stub
308  0 return null;
309    }
310   
 
311  0 toggle @Override
312    public List<MilestoneTypeInfo> getMilestoneTypesForAtpType(
313    String atpTypeKey) throws DoesNotExistException,
314    InvalidParameterException, MissingParameterException,
315    OperationFailedException {
316    // TODO Auto-generated method stub
317  0 return null;
318    }
319   
 
320  0 toggle @Override
321    public List<MilestoneInfo> getMilestonesByAtp(String atpKey)
322    throws InvalidParameterException, MissingParameterException,
323    OperationFailedException {
324    // TODO Auto-generated method stub
325  0 return null;
326    }
327   
 
328  0 toggle @Override
329    public List<MilestoneInfo> getMilestonesByDates(Date startDate,
330    Date endDate) throws InvalidParameterException,
331    MissingParameterException, OperationFailedException {
332    // TODO Auto-generated method stub
333  0 return null;
334    }
335   
 
336  0 toggle @Override
337    public List<MilestoneInfo> getMilestonesByDatesAndType(
338    String milestoneTypeKey, Date startDate, Date endDate)
339    throws InvalidParameterException, MissingParameterException,
340    OperationFailedException {
341    // TODO Auto-generated method stub
342  0 return null;
343    }
344   
 
345  0 toggle @Override
346    public StatusInfo removeDateRange(String dateRangeKey)
347    throws DoesNotExistException, InvalidParameterException,
348    MissingParameterException, OperationFailedException,
349    PermissionDeniedException {
350    // TODO Auto-generated method stub
351  0 return null;
352    }
353   
 
354  0 toggle @Override
355    public StatusInfo removeMilestone(String milestoneKey)
356    throws DoesNotExistException, InvalidParameterException,
357    MissingParameterException, OperationFailedException,
358    PermissionDeniedException {
359    // TODO Auto-generated method stub
360  0 return null;
361    }
362   
 
363  0 toggle @Override
364    public AtpInfo updateAtp(String atpKey, AtpInfo atpInfo)
365    throws DataValidationErrorException, DoesNotExistException,
366    InvalidParameterException, MissingParameterException,
367    OperationFailedException, PermissionDeniedException,
368    VersionMismatchException {
369    // TODO Auto-generated method stub
370  0 return null;
371    }
372   
 
373  0 toggle @Override
374    public DateRangeInfo updateDateRange(String dateRangeKey,
375    DateRangeInfo dateRangeInfo)
376    throws DataValidationErrorException, DoesNotExistException,
377    InvalidParameterException, MissingParameterException,
378    OperationFailedException, PermissionDeniedException,
379    VersionMismatchException {
380    // TODO Auto-generated method stub
381  0 return null;
382    }
383   
 
384  0 toggle @Override
385    public MilestoneInfo updateMilestone(String milestoneKey,
386    MilestoneInfo milestoneInfo)
387    throws DataValidationErrorException, DoesNotExistException,
388    InvalidParameterException, MissingParameterException,
389    OperationFailedException, PermissionDeniedException,
390    VersionMismatchException {
391    // TODO Auto-generated method stub
392  0 return null;
393    }
394   
 
395  0 toggle @Override
396    public List<ValidationResultInfo> validateAtp(String validationType,
397    AtpInfo atpInfo) throws DoesNotExistException,
398    InvalidParameterException, MissingParameterException,
399    OperationFailedException {
400    // TODO Auto-generated method stub
401  0 return null;
402    }
403   
 
404  0 toggle @Override
405    public List<ValidationResultInfo> validateDateRange(
406    String validationType, DateRangeInfo dateRangeInfo)
407    throws DoesNotExistException, InvalidParameterException,
408    MissingParameterException, OperationFailedException {
409    // TODO Auto-generated method stub
410  0 return null;
411    }
412   
 
413  0 toggle @Override
414    public List<ValidationResultInfo> validateMilestone(
415    String validationType, MilestoneInfo milestoneInfo)
416    throws DoesNotExistException, InvalidParameterException,
417    MissingParameterException, OperationFailedException {
418    // TODO Auto-generated method stub
419  0 return null;
420    }
421   
 
422  0 toggle @Override
423    public SearchCriteriaTypeInfo getSearchCriteriaType(
424    String searchCriteriaTypeKey) throws DoesNotExistException,
425    InvalidParameterException, MissingParameterException,
426    OperationFailedException {
427    // TODO Auto-generated method stub
428  0 return null;
429    }
430   
 
431  0 toggle @Override
432    public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes()
433    throws OperationFailedException {
434    // TODO Auto-generated method stub
435  0 return null;
436    }
437   
 
438  0 toggle @Override
439    public SearchResultTypeInfo getSearchResultType(
440    String searchResultTypeKey) throws DoesNotExistException,
441    InvalidParameterException, MissingParameterException,
442    OperationFailedException {
443    // TODO Auto-generated method stub
444  0 return null;
445    }
446   
 
447  0 toggle @Override
448    public List<SearchResultTypeInfo> getSearchResultTypes()
449    throws OperationFailedException {
450    // TODO Auto-generated method stub
451  0 return null;
452    }
453   
 
454  0 toggle @Override
455    public SearchTypeInfo getSearchType(String searchTypeKey)
456    throws DoesNotExistException, InvalidParameterException,
457    MissingParameterException, OperationFailedException {
458    // TODO Auto-generated method stub
459  0 return null;
460    }
461   
 
462  0 toggle @Override
463    public List<SearchTypeInfo> getSearchTypes()
464    throws OperationFailedException {
465    // TODO Auto-generated method stub
466  0 return null;
467    }
468   
 
469  0 toggle @Override
470    public List<SearchTypeInfo> getSearchTypesByCriteria(
471    String searchCriteriaTypeKey) throws DoesNotExistException,
472    InvalidParameterException, MissingParameterException,
473    OperationFailedException {
474    // TODO Auto-generated method stub
475  0 return null;
476    }
477   
 
478  0 toggle @Override
479    public List<SearchTypeInfo> getSearchTypesByResult(
480    String searchResultTypeKey) throws DoesNotExistException,
481    InvalidParameterException, MissingParameterException,
482    OperationFailedException {
483    // TODO Auto-generated method stub
484  0 return null;
485    }
486   
 
487  0 toggle @Override
488    public SearchResult search(SearchRequest searchRequest)
489    throws MissingParameterException {
490    // TODO Auto-generated method stub
491  0 return null;
492    }
493   
494    }
495    }